Charles Merriam schrieb: > On Wed, Mar 26, 2008 at 9:33 PM, Talin <[EMAIL PROTECTED]> wrote: > .... >> For new code, however, there is an alternative strategy that doesn't >> involve 2to3 at all, which is to write code in the "greatest common >> subset" of 2.6 and 3.0. >> >> As Lennart Regbro pointed out earlier, this common subset is actually >> quite large (larger than Guido originally intended, I think), and you >> can write some fairly substantial applications in it. > > Ok, I'll bite. How can I write the greatest common denominator of this code: > > print "Hello World!" # yes, that needs to be Unicode.
>>> from __future__ import unicode_literals >>> print "Hello World!" # this is unicode >>> from __future__ import print_function >>> print("Hello World!") >>> "" u'' >>> type("") is unicode True >>> type("") is str False >>> type(b"") is bytes True >>> type(b"") is str True >>> type(u"") is unicode True Christian _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com