This PEP outlines the introduction of a rawbytes sequence objectand the unification of the currentstr andunicode objects.
This PEP is rejected in this form. The author has expressed lack oftime to continue to shepherd it, and discussion on python-dev hasmoved to a slightly different proposal which will (eventually) bewritten up as a new PEP. See the thread starting athttps://mail.python.org/pipermail/python-dev/2006-February/060930.html.
Python’s current string objects are overloaded. They serve both tohold ASCII and non-ASCII character data and to also hold sequences ofraw bytes which have no reasonable interpretation as displayablecharacter sequences. This overlap hasn’t been a big problem in thepast, but as Python moves closer to requiring source code to beproperly encoded, the use of strings to represent raw byte sequenceswill be more problematic. In addition, as Python’s Unicode supporthas improved, it’s easier to consider strings as ASCII-encoded Unicodeobjects.
The number in parentheses indicates the Python version in which thefeature will be introduced.
bytes builtin which is just a synonym forstr. (2.5)b"..." string literal which is equivalent to raw stringliterals, with the exception that values which conflict with thesource encoding of the containing file not generate warnings. (2.5)bytes builtin which refers to a sequence distinctfrom thestr type. (2.6)str a synonym forunicode. (3.0)TBD.
bytes objects be mutable or immutable? (Guido seems tolike them to be mutable.)This document has been placed in the public domain.
Source:https://github.com/python/peps/blob/main/peps/pep-0332.rst
Last modified:2025-02-01 08:59:27 GMT