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

Nick Coghlan ncoghlan at gmail.com
Tue Feb 28 13:14:54 CET 2012


On Tue, Feb 28, 2012 at 9:52 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> On Tue, 28 Feb 2012 21:42:54 +1000
> Nick Coghlan <ncoghlan at gmail.com> wrote:
>> But the existing approaches require that, in order to be
>> forward compatible with Python 3, a program must be made *worse* in
>> Python 2 (i.e. harder to read and harder to write correctly for
>> someone that hasn't learned Python 3 yet).
>
> Wrong. The separate branches approach allows you to have a clean
> Python 3 codebase without crippling the Python 2 codebase.
> Of course that approach was downplayed from the start in favour of
> using 2to3 on a single codebase, and now we discover that this approach
> is cumbersome.

If you're using separate branches, then your Python 2 code isn't being
made forward compatible with Python 3. Yes, it avoids making your
Python 2 code uglier, but it means maintaining two branches in
parallel until you drop Python 2 support. You've once again raised the
barrier to entry: either people contribute two patches, or they accept
that their patch may languish until someone else writes the patch for
the other version. Again, as with 2to3, that approach obviously
*works* (we've done it ourselves for years with the standard library),
but it's hardly a low friction approach to porting.

That's all PEP 414 is about - lowering the friction of porting to
Python 3. Is it *necessary*? No, there are already enough successful
ports to prove that, if sufficiently motivated, porting to Python 3 is
feasible with the current toolset. However, that's the wrong question.
The right question is "Does PEP 414 make porting substantially
*easier*, by significantly reducing the volume of code that needs to
change in order to attain Python 3 compatibility?". And the answer to
*that* question is "Absolutely." Porting the web frameworks themselves
to Python 3 is only the first step in migrating those ecosystems to
Python 3, and because the web APIs exposed by those frameworks are so
heavily Unicode based this is an issue that will hit pretty much every
Python web app and library on the planet.

Cheers,
Nick.

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


More information about the Python-Dev mailing list