[Python 2.6] print_function and unicode_literals cannot be used at the same time?
Terry Reedy
tjreedy at udel.edu
Mon Oct 27 14:00:48 EDT 2008
Gabriel Genellina wrote:
> En Sun, 26 Oct 2008 12:13:08 -0200, Christian Heimes <lists at cheimes.de>
> escribió:
>
>> ?????? wrote:
>>> Any ideas?
>>> Code 1:
>>> from __future__ import print_function, unicode_literals
>>> import sys
>>> print(type('HELLO, WORLD!'), file=sys.stderr)
>>
>> You have to do each future import in a separate line:
>>
>> >>> from __future__ import unicode_literals
>> >>> from __future__ import print_function
>> >>> print(type(""), file=sys.stderr)
>> <type 'unicode'>
>
> That's a bug, isn't it? The language reference explicitely allows it:
> http://docs.python.org/reference/simple_stmts.html#future-statements
Yes, and Benjamin Peterson already submitted a patch because of this thread.
http://bugs.python.org/issue4209
More information about the Python-list
mailing list