python 2.7 and unicode (one more time)

Steven D'Aprano steve+comp.lang.python at pearwood.info
Tue Nov 25 06:56:38 EST 2014


Marko Rauhamaa wrote:

> Steven D'Aprano <steve+comp.lang.python at pearwood.info>:
> 
>> Marko Rauhamaa wrote:
>>
>>>> Py3's byte strings are still strings, though.
>>> 
>>> Hm. I don't think so. In a plain English sense, maybe, but that kind of
>>> usage can lead to confusion.
>>
>> Only if you are determined to confuse yourself.
>>
>> {...]
>>
>> In Python usage, "string" always refers to the `str` type, unless
>> prefixed with "byte", in which case it refers to the immutable
>> byte-string type (`str` in Python 2, `bytes` in Python 3.)
> 
> You are saying what I'm saying.
> 
> Byte strings are *not* strings.

Of course they are. They are strings of bytes, just as the name suggests.


> Prairie dogs are not dogs. No need to call dogs "domesticated dogs" to
> tell them apart from "prairie dogs".

But wild dogs *are* dogs, and there is a need to distinguish between wild
dogs and domesticated dogs. 

Just as there is a need to distinguish between byte strings, ASCII strings,
Latin-1 strings, Big5 strings, Unicode strings, Tron strings and cheese
strings.

I think this conversation is going nowhere, so it's probably best to end it.



-- 
Steven




More information about the Python-list mailing list