[docs] [issue21667] Clarify status of O(1) indexing semantics of str objects
report at bugs.python.org
Wed Jun 11 01:02:39 CEST 2014
Jim Jewett added the comment:
I think the new wording is an improvement, but keeping the changes minimal left it in an awkward in-between state.
A string is a sequence of Unicode code points. Strings can include any sequence of code points, including some which are semantically meaningless, or explicitly undefined.
Python doesn't have a :c:type:`char` type; a single code point is represented as a string of length ``1``. The built-in function :func:`chr` translates an integer in the range ``U+0000 - U+10FFFF`` to the corresponding length ``1`` string object, and :func:`ord` does the reverse.
:meth:`str.encode` provides a concrete representation (as :class:`bytes` in the given text encoding) suitable for transport and communication with non-Python utilities. :meth:`bytes.decode` decodes such byte sequences into text strings.
Python tracker <report at bugs.python.org>
More information about the docs