[Python-3000] u'text' as an alias for 'text'?

Christian Heimes lists at cheimes.de
Thu Mar 20 21:15:38 CET 2008


Lennart Regebro schrieb:
> Now, before we all get into doomsday mode, there is good news. First
> of all, 2.6a1 already contains a lot of forwards compatibility. And
> with the "from __future__ import print_function", which adds more such
> compatibility. The horrible complete compatibility break that we were
> so worried about might never happen. All that is needed is pretty much
> a from __future__ import unicode_string_literals, and  far as I'm
> concerned we are all set.


How about "from __future__ import py3k_literals" for Python 2.6? The 
future statement turns several literals into Python 3.0 mode:

* '' creates an unicode object instead of a str object
* b'' creates a str object (aka bytes in Python 3.0)
* 1 creates a long instead of an int
* 1L and u'' are invalid

Christian


More information about the Python-3000 mailing list