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

Vinay Sajip vinay_sajip at yahoo.co.uk
Mon Feb 27 22:53:06 CET 2012


Ethan Furman <ethan <at> stoneleaf.us> writes:

> True -- but I would rather have u'' in 2.6 and 3.3 than u('') in 2.6 and 
> 3.3.

You don't need u('') in 2.6 - why do you think you need it there?

If you don't implement this PEP, you can have, *uniformly* across 2.6, 2.7 and
all 3.x versions, 'xxx' for text and b'yyy' for bytes. For 2.6 you would have to
add "from __future__ import unicode_literals", and this might uncover places
where you need to change things to use bytes or native strings - either because
of bugs in the original code, or drawbacks in a Python version where you can't
use Unicode as keys in a kwargs dictionary, or some API that wants you to use
str explicitly. But at least some of those places will be things you would have
to address anyway, when porting, whatever the state of Unicode literal support.

Regards,

Vinay Sajip




More information about the Python-Dev mailing list