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

Terry Reedy tjreedy at udel.edu
Tue Feb 28 00:19:25 CET 2012


On 2/27/2012 4:56 PM, Jim J. Jewett wrote:

> In http://mail.python.org/pipermail/python-dev/2012-February/116953.html
> Terry J. Reedy wrote:
>
>> I presume that most 2.6 code has problems other than u'' when
>> attempting to run under 3.x.
>
> Why?

Since writing the above, I realized that the following is a realistic 
scenario. 2.6 or 2.7 code a) uses has/set/getattr, so unicode literals 
would require a change; b) uses non-ascii chars in unicode literals; c) 
uses (or could be converted to use) print as a function; and d) 
otherwise uses a common 2-3 subset. Such would only need the u prefix 
addition to run under both Pythons. This works the other way, of course, 
for backporting code. So I am replacing 'most' with 'some unknown-to-me 
fraction' ;-).

-- 
Terry Jan Reedy



More information about the Python-Dev mailing list