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

Brett Cannon brett at python.org
Sun Feb 26 23:44:29 CET 2012


On Sat, Feb 25, 2012 at 22:13, Guido van Rossum <guido at python.org> wrote:

> If this can encourage more projects to support Python 3 (even if it's
> only 3.3 and later) and hence improve adoption of Python 3, I'm all
> for it.
>
>
+1 from me for the same reasons.

If this were to go in then for Python 3.3 the section of the porting HOWTO
on what to do when you support Python 2.6 and later (
http://docs.python.org/howto/pyporting.html#python-2-3-compatible-source)
would change to:

* Use ``from __future__ import print_functions`` OR use ``print(x)`` but
always with a single argument OR use six
* Use ``from __future__ import unicode_literals`` OR make sure to use the
'u' prefix for all Unicode strings (and then mention the concept of native
strings) or use six
* Use the 'b' prefix for byte literals or use six

All understandable and with either a __future__ import solution or
syntactic support solution for all issues, giving people the choice of
either approach for what they prefer for each approach. I would also be
willing to move the Python 2/3 compatible source section to the top and
thus implicitly become the preferred way to port since people in the
community have seemingly been gravitating towards that approach even
without this help.

-Brett


A small quibble: I'd like to see a benchmark of a 'u' function implemented
> in C.
>
> --Guido
>
> On Sat, Feb 25, 2012 at 12:23 PM, Armin Ronacher
> <armin.ronacher at active-4.com> wrote:
> > Hi,
> >
> > I just uploaded PEP 414 which proposes am optional 'u' prefix for string
> > literals for Python 3.
> >
> > You can read the PEP online: http://www.python.org/dev/peps/pep-0414/
> >
> > This is a followup to the discussion about this topic here on the
> > mailinglist and on twitter/IRC over the last few weeks.
> >
> >
> > Regards,
> > Armin
> > _______________________________________________
> > Python-Dev mailing list
> > Python-Dev at python.org
> > http://mail.python.org/mailman/listinfo/python-dev
> > Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/guido%40python.org
>
>
>
> --
> --Guido van Rossum (python.org/~guido)
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/brett%40python.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20120226/caa270a9/attachment-0001.html>


More information about the Python-Dev mailing list