python 2.7 and unicode (one more time)

Chris Angelico rosuav at gmail.com
Mon Nov 24 18:08:31 EST 2014


On Tue, Nov 25, 2014 at 9:56 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> In all cases apart from an explicit "byte string", the word "string" is
> always used for the native array-of-characters type delimited by plain
> quotation marks, as used for error messages, user prompts, etc., regardless
> whether the implementation is an array of 8-bit bytes (as used by Python
> 2), or the full Unicode character set (as used by Python 3). So in
> practice, provided you know which version of Python is being discussed,
> there is never any genuine ambiguity when using the word "string" and no
> excuse for confusion.

And frequently, even if you're talking about Py2/Py3 cross code,
there's still no ambiguity about the word "string": it means a
default-for-the-language string. The locale.setlocale() function
expects a string as its second parameter, for instance. (And
unfortunately, flatly refuses the other sort, whichever way around
that is.)

ChrisA



More information about the Python-list mailing list