Py3.3 unicode literal and input()

Steven D'Aprano steve+comp.lang.python at pearwood.info
Mon Jun 18 06:11:28 EDT 2012


On Mon, 18 Jun 2012 02:30:50 -0700, jmfauth wrote:

> On 18 juin, 10:28, Benjamin Kaplan <benjamin.kap... at case.edu> wrote:

>> The u prefix is only there to
>> make it easier to port a codebase from Python 2 to Python 3. It doesn't
>> actually do anything.
> 
> 
> It does. I shew it!

Incorrect. You are assuming that Python 3 input eval's the input like 
Python 2 does. That is wrong. All you show is that the one-character 
string "a" is not equal to the four-character string "u'a'", which is 
hardly a surprise. You wouldn't expect the string "3" to equal the string 
"int('3')" would you?



-- 
Steven



More information about the Python-list mailing list