[Python 2.6] print_function and unicode_literals cannot be used at the same time?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Oct 27 02:14:43 EDT 2008


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

-- 
Gabriel Genellina




More information about the Python-list mailing list