[issue41377] memoryview of str (unicode)

Eric V. Smith report at bugs.python.org
Thu Jul 23 17:51:21 EDT 2020


Eric V. Smith <eric at trueblade.com> added the comment:

> AIUI (though I could be misunderstanding things) `str` objects do use some kind of typed array of unicode characters (either 16-bit narrow or 32-bit wide). 

It's somewhat more complicated. The string data is stored differently depending on the maximum code point in the string. See PEP 393.

The "kind" field describes this as:
1 byte (Latin-1)
2 byte (UCS-2)
4 byte (UCS-4)

----------
nosy: +eric.smith

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41377>
_______________________________________


More information about the Python-bugs-list mailing list