In someone else's code I saw this:

return u'' 

The empty unicode string u'' somehow different from just the empty string '' ? If so, what?

    1 answer 1

    The difference in type:

     >>> u'' == '' True >>> type(u'') == type('') False >>> type(u'') <type 'unicode'> >>> type('') <type 'str'> 

    Although it is rather ephemeral:

     >>> type('' u'я') <type 'unicode'> 
    • Well, yes, obviously. :) Or maybe a code that works differently with these two empty lines? Of course, except for the conditions by type of object. - Nick Volynkin
    • (minus not mine, by the way) - Nick Volynkin
    • incomprehensible for that minus ... - MaxU