[Python-Dev] PEP 332 revival in coordination with pep 349? [ Was:Re: release plan for 2.5 ?]

"Martin v. Löwis" martin at v.loewis.de
Tue Feb 14 07:58:01 CET 2006


Guido van Rossum wrote:
>>In py3k, when the str object is eliminated, then what do you have?
>>Perhaps
>>- bytes("\x80"), you get an error, encoding is required. There is no
>>such thing as "default encoding" anymore, as there's no str object.
>>- bytes("\x80", encoding="latin-1"), you get a bytestring with a
>>single byte of value 0x80.
> 
> 
> Yes to both again.

Please reconsider, and don't give bytes() an encoding= argument.
It doesn't need one. In Python 3, people should write

  "\x80".encode("latin-1")

if they absolutely want to, although they better write

  bytes([0x80])

Now, the first form isn't valid in 2.5, but

  bytes(u"\x80".encode("latin-1"))

could work in all versions.

Regards,
Martin


More information about the Python-Dev mailing list