[Python-Dev] Python 3.x and bytes

Nick Coghlan ncoghlan at gmail.com
Wed May 18 05:40:14 CEST 2011


On Wed, May 18, 2011 at 1:23 PM, Robert Collins
<robertc at robertcollins.net> wrote:
> The Python 2 confusion was deplorable, but it doesn't make the Python
> 3 situation better: its different, but still very awkward for people
> to write code that is correct and fast in.

When Python 3 goes wrong, it raises exceptions or executes the wrong
control flow. That's a vast improvement over silently corrupting the
data stream the way that 2.x does.

If it really bothers anyone, they should feel free to implement and
promote their own "ascii" data type on PyPI. If it is explicitly
restricted to 7 bit characters, it may even avoid many of the problems
of silent corruption that the 2.x str had. Speculation on python-dev
isn't going to be convincing here, though: only code in real use will
be effective on that front.

As far as the memory and runtime overhead goes, yes, that's a real
problem (indeed, that overhead is *why* bytes and bytearray have as
many str-like features as they do). PEP 393 is intended to at least
alleviate the memory burden of the Unicode text.

Cheers,
Nick.

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


More information about the Python-Dev mailing list