On Sun, Feb 26, 2012 at 9:00 PM, Steven D'Aprano <st...@pearwood.info> wrote: > I think your suggestion is not well explained. You suggested a function n, > expected to take a string literal. The example you gave earlier was: > > n('xxx') > > But it seems to me that this is a no-op, because 'xxx' is already the native > string type. In Python 2, it gives a str (byte-string), which the n() > function converts to a byte-string. In Python 3, it gives a str > (unicode-string), which the n() function converts to a unicode-string.
Vinay's suggestion was that it be used in conjunction with the "from __future__ import unicode_literals" import, so that you could write: b"" # Binary data "" # Text (unicode) data str("") # Native string type It reduces the problem (compared to omitting the import and using a u() function), but it's still ugly and still involves the "action at a distance" of the unicode literals import. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com