python 2.7 and unicode (one more time)
Marko Rauhamaa
marko at pacujo.net
Sat Nov 22 01:40:38 EST 2014
Steven D'Aprano <steve+comp.lang.python at pearwood.info>:
> In Python, we have Unicode strings and byte strings.
No, you don't. You have strings and bytes:
Textual data in Python is handled with str objects, or strings.
Strings are immutable sequences of Unicode code points. String
literals are written in a variety of ways: [...]
<URL: https://docs.python.org/3/library/stdtypes.html#text-sequence-typ
e-str>
The core built-in types for manipulating binary data are bytes and bytearray.
<URL: https://docs.python.org/3/library/stdtypes.html#binary-sequence-t
ypes-bytes-bytearray-memoryview
Equivalently, I wouldn't mind "character strings" vs "byte strings".
Unicode strings is not wrong but the technical emphasis on Unicode is as
strange as a "tire car" or "rectangular door" when "car" and "door" are
what you usually mean.
Marko
More information about the Python-list
mailing list