[Python-Dev] readd u'' literal support in 3.3?

Barry Warsaw barry at python.org
Fri Dec 9 04:38:16 CET 2011


On Dec 08, 2011, at 06:53 PM, Guido van Rossum wrote:

>Are you saying that with that future import, b"..." is still a Unicode
>literal?

No, the future import has no impact on b-strings.

-----snip snip-----
from __future__ import print_function
import sys
print(sys.version_info.major, sys.version_info.minor, type(b''))
-----snip snip-----

$ python /tmp/foo.py
2 7 <type 'str'>
$ python3 /tmp/foo.py
3 2 <class 'bytes'>

-----snip snip-----
from __future__ import print_function, unicode_literals
import sys
print(sys.version_info.major, sys.version_info.minor, type(b''))
-----snip snip-----

$ python /tmp/foo.py
2 7 <type 'str'>
$ python3 /tmp/foo.py
3 2 <class 'bytes'>

Cheers,
-Barry


More information about the Python-Dev mailing list