[Python-Dev] Py3k bytes type in 2.x (Re: nonlocal keyword in 2.x?)

Lennart Regebro regebro at gmail.com
Thu Nov 5 21:38:32 CET 2009


2009/11/4 Nick Coghlan <ncoghlan at gmail.com>:
> Lennart Regebro wrote:
>> I also would really like to see a real port of the bytes class to 2.6,
>> but I have a vague memory that there was some reason that wouldn't
>> work.
>
> Not so much that it wouldn't work, but that the interfaces to support
> using it effectively really aren't there - lots of areas in the standard
> library needed to be tweaked to cope with bytes objects in 3.x.

Ah, right, that was the problem, the standard library. I knew I heard
a good reason against it.

> Generally speaking, the "bytes = str" trick represents a reasonable
> compromise as the APIs that you would pass a bytes object to in 3.x
> expect an 8-bit str instance in 2.x.

Yeah, the problem being that bytes and str has quite different API's. Ah well.

-- 
Lennart Regebro: Python, Zope, Plone, Grok
http://regebro.wordpress.com/
+33 661 58 14 64


More information about the Python-Dev mailing list