Movatterモバイル変換
[0]ホーム
[Python-Dev] PEP 414
Nick Coghlanncoghlan at gmail.com
Sun Feb 26 12:20:16 CET 2012
On Sun, Feb 26, 2012 at 9:00 PM, Steven D'Aprano <steve at 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) datastr("") # Native string typeIt reduces the problem (compared to omitting the import and using au() function), but it's still ugly and still involves the "action at adistance" of the unicode literals import.Cheers,Nick.--Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Python-Devmailing list
[8]ページ先頭