Eric Smith wrote:
> Greg Ewing wrote:
>> Charles Merriam wrote:
>>> How can I write the greatest common denominator of this code:
>>>
>>> print "Hello World!" # yes, that needs to be Unicode.
>> Something like
>>
>> from __future__ import unicode_literals
>> from py3k_compat import Print
>>
>> Print("Hello World!") # yes, that indeed is Unicode.
>>
>> given suitable implementations of py3k_compat for
>> each environment.
>>
>
> Am I missing something here? What's wrong with:
>
> $ ./python.exe
> Python 2.6a1+ (trunk:61978, Mar 27 2008, 12:48:39)
> [GCC 4.0.1 (Apple Inc. build 5465)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from __future__ import unicode_literals
> >>> from __future__ import print_function
> >>> print('hello, world')
> hello, world
> >>> type('hello, world')
> <type 'unicode'>
> >>>
>
> The only problem I see is that the __future__ import of unicode_literals
> doesn't work in 3.0 yet. I'll look into fixing that.
Someone beat me to it. Those exact same statements already work in
trunk and py3k (except the type of a string literal is str, of course).
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com