print_function and unicode_literals cannot be used at the same time?

Benjamin musiccomposition at gmail.com
Tue Oct 28 23:07:33 EDT 2008


On Oct 27, 1:00 pm, Terry Reedy <tjre... at udel.edu> wrote:
> Gabriel Genellina wrote:
> > En Sun, 26 Oct 2008 12:13:08 -0200, Christian Heimes <li... 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

It will be fixed in 2.6.1.



More information about the Python-list mailing list