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

Vinay Sajip vinay_sajip at yahoo.co.uk
Tue Feb 28 13:10:43 CET 2012


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

 
> Distribute helps with this. I think we might have to add a support in
> distribute to easily exclude the fixer that removes u''-prefixes, I
> don't remember if there is an "exclude" feature.

We might be at cross purposes here. I don't see how Distribute helps, because
the use case I'm talking about is not about distributing or installing stuff,
but iteratively changing and testing code which needs to work on 2.6+, 3.2 and
3.3+. 

If the 2.x code depends on having u'xxx' literals, then 3.2 testing will
potentially involve running a fixer on all files in the project every time a
change is made, writing to a separate directory, or else a fixer which is
integrated into the editing environment so it knows what changed. This is
painful, and what motivated PEP 314 in the first place - which seems ironic.

The PEP 314 approach seems to assume that that if things work on 3.3, they will
work on 3.2/3.1/3.0 without any changes other than replacing u'xxx' with 'xxx'.
In other words, you aren't supposed to want to e.g. test 3.2 and 3.3
iteratively, using a workflow which intersperses edits with running tests using
3.2 and running tests with 3.3.

In any case, a single code base seems not to be possible across
2.6+/3.0/3.1/3.2/3.3+ using the PEP 314 approach, though of course one will be
possible for just 2.6+/3.3+. Early adopters of 3.x seem to be penalised by this
approach: I for one will try to use the unicode_literals approach wherever I can.

Regards,

Vinay Sajip



More information about the Python-Dev mailing list