[Python-Dev] PEP 414 - Unicode Literals for Python 3

Vinay Sajip vinay_sajip at yahoo.co.uk
Tue Feb 28 08:51:22 CET 2012


Lennart Regebro <regebro <at> gmail.com> writes:

> I'm +1 on the PEP, for reasons already repeated here.
> We need three types of strings when supporting both Python 2 and
> Python 3. A binary string, a unicode string and a "native" string, ie
> one that is the old 8-bit str in python 2 but a Unicode str in Python
> 3.

Well it's a done deal, and as I said elsewhere on the thread, I wasn't opposing
the PEP, but wanting some improvements in it. ISTM that given the PEP as it is,
working across 3.2 and 3.3 on a single codebase may not always be the easiest
process (IIUC you have to run a mini2to3 process, and it'll need to be cleverer
than 2to3 about running over the entire codebase if it's to appear seamless),
but I guess that's a smaller number of people you'd upset, and those people are
committed to 3.x anyway. It's the 2.x porters we're trying to win over - I see
that. It will be very nice if this leads to an increase in the rate at which
libraries are ported to 3.x.

> Adding back the u'' prefix is the easiest, most
> obvious/intuitive/pythong/whatever way of getting that support, that
> requires the least amount of code change, and the least ugly code.

"Least ugly" is subjective; I find u'xxx' less pretty than 'xxx' for text.

Regards,

Vinay Sajip





More information about the Python-Dev mailing list