[Python-3000] [Python-Dev] Byte literals (was Re: [Python-checkins] Changing string constants to byte arrays ( r55119 - in python/branches/py3k-struni/Lib: codecs.py test/test_codecs.py ))

Jason Orendorff jason.orendorff at gmail.com
Tue May 8 15:16:32 CEST 2007

On 5/7/07, Guido van Rossum <guido at python.org> wrote:
> I don't know how this will work out yet. I'm not convinced that having
> both mutable and immutable bytes is the right thing to do; but I'm
> also not convinced of the opposite. I am slowly working on the
> string/unicode unification, and so far, unfortunately, it is quite
> daunting to get rid of 8-bit strings even at the Python level let
> alone at the C level.

Guido, if 3.x had an immutable bytes type, could 2to3 provide a
better guarantee?  Namely, "Set your default encoding to None
in your 2.x code today, and 2to3 will not introduce bugs around

2to3 could produce 3.x code that preserves the 2.x meaning by
using 2.x-ish types, including immutable byte strings.

Without this, my understanding is that 2to3 will introduce bugs.
Am I wrong?

This might be worth doing even if you decide an immutable 8-bit
type is wrong for the core language.  The type could be hidden
away in an "upgradelib" module somewhere.  Surely people will
prefer correctness over "producing nice, idiomatic 3.x code"
in the 2to3 tool.


More information about the Python-3000 mailing list