[Python-ideas] Adding 'bytes' as alias for 'latin_1' codec.

Stefan Behnel stefan_ml at behnel.de
Thu May 26 11:15:19 CEST 2011


Terry Reedy, 26.05.2011 03:58:
> If such a thing were added, the 256 bytes should directly map to the first
> 256 codepoints. I don't know if 'latin1' does that or not.

Yes, Unicode was specifically designed to support that. The first 128 code 
points are identical with the ASCII encoding, the first 256 code points are 
identical with the Latin-1 encoding.

See also PEP 393, which exploits this feature.

http://www.python.org/dev/peps/pep-0393/

That being said, I don't see the point of aliasing "latin-1" to "bytes" in 
the codecs. That sounds confusing to me.

Stefan




More information about the Python-ideas mailing list