Vinay Sajip wrote:
Serhiy Storchaka
writes: n = str
Well, n to indicate that native string is required.
str indicates the native string type, because it *is* the native string type. By definition, str = str in both Python 2.x and Python 3.x. There's no point in aliasing it to "n". Besides, "n" is commonly used for ints. It would be disturbing for me to read code with n a function or type, particularly one that returns a string. 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. -- Steven