[Python-Dev] bytes.from_hex() [Was: PEP 332 revival in coordination with pep 349?] (original) (raw)

"Martin v. Löwis" martin at v.loewis.de
Sat Feb 18 17:15:14 CET 2006


M.-A. Lemburg wrote:

I've already explained why we have .encode() and .decode() methods on strings and Unicode many times. I've also explained the misunderstanding that can codecs only do Unicode-string conversions. And I've explained that the .encode() and .decode() method do check the return types of the codecs and only allow strings or Unicode on return (no lists, instances, tuples or anything else).

You seem to ignore this fact.

I'm not ignoring the fact that you have explained this many times. I just fail to understand your explanations.

For example, you said at some point that codecs are not restricted to Unicode. However, I don't recall any explanation what the restriction is, if any restriction exists. No such restriction seems to be documented.

True. However, note that the .encode()/.decode() methods on strings and Unicode narrow down the possible return types. The corresponding .bytes methods should only allow bytes and Unicode.

I forgot that: what is the rationale for that restriction?

Regards, Martin



More information about the Python-Dev mailing list