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

Nick Coghlan ncoghlan at gmail.com
Thu Nov 5 13:19:45 CET 2009

Martin v. Löwis wrote:
> Nick Coghlan wrote:
>> 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.
> I see the problem differently: if a bytes type was added, nothing would
> use it. In particular, IO wouldn't start returning bytes (although it
> could accept them); IO would continue to return str. Therefore, I'm
> skeptical that adding a *third* string type to 3.x would do any good.

I'm guessing you meant '2.x' in that last sentence, in which case we
agree (just emphasising different parts of the "binary data" ecosystem
that would be necessary to make a backported bytes type effective).

Although I think Guido did a better job than either of us in explaining
why backporting the full bytes type to 2.x really wouldn't help all that


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-Dev mailing list