diff options
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/codecs.rst | 6 | ||||
-rw-r--r-- | Doc/library/stdtypes.rst | 44 | ||||
-rw-r--r-- | Doc/whatsnew/3.2.rst | 20 |
3 files changed, 2 insertions, 68 deletions
diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst index 26e31a4..c9222ca 100644 --- a/Doc/library/codecs.rst +++ b/Doc/library/codecs.rst @@ -1165,8 +1165,7 @@ particular, the following variants typically exist: | | | operand | +--------------------+---------+---------------------------+ -The following codecs provide bytes-to-bytes mappings. They can be used with -:meth:`bytes.transform` and :meth:`bytes.untransform`. +The following codecs provide bytes-to-bytes mappings. +--------------------+---------------------------+---------------------------+ | Codec | Aliases | Purpose | @@ -1192,8 +1191,7 @@ The following codecs provide bytes-to-bytes mappings. They can be used with | | | using gzip | +--------------------+---------------------------+---------------------------+ -The following codecs provide string-to-string mappings. They can be used with -:meth:`str.transform` and :meth:`str.untransform`. +The following codecs provide string-to-string mappings. +--------------------+---------------------------+---------------------------+ | Codec | Aliases | Purpose | diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 6ebf2a0..b2931ae 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1352,19 +1352,6 @@ functions based on regular expressions. "They're Bill's Friends." -.. method:: str.transform(encoding, errors='strict') - - Return an encoded version of the string. In contrast to :meth:`encode`, this - method works with codecs that provide string-to-string mappings, and not - string-to-bytes mappings. :meth:`transform` therefore returns a string - object. - - The codecs that can be used with this method are listed in - :ref:`standard-encodings`. - - .. versionadded:: 3.2 - - .. method:: str.translate(map) Return a copy of the *s* where all characters have been mapped through the @@ -1382,14 +1369,6 @@ functions based on regular expressions. example). -.. method:: str.untransform(encoding, errors='strict') - - Return a decoded version of the string. This provides the reverse operation - of :meth:`transform`. - - .. versionadded:: 3.2 - - .. method:: str.upper() Return a copy of the string converted to uppercase. @@ -1821,20 +1800,6 @@ The bytes and bytearray types have an additional class method: The maketrans and translate methods differ in semantics from the versions available on strings: -.. method:: bytes.transform(encoding, errors='strict') - bytearray.transform(encoding, errors='strict') - - Return an encoded version of the bytes object. In contrast to - :meth:`encode`, this method works with codecs that provide bytes-to-bytes - mappings, and not string-to-bytes mappings. :meth:`transform` therefore - returns a bytes or bytearray object. - - The codecs that can be used with this method are listed in - :ref:`standard-encodings`. - - .. versionadded:: 3.2 - - .. method:: bytes.translate(table[, delete]) bytearray.translate(table[, delete]) @@ -1852,15 +1817,6 @@ available on strings: b'rd ths shrt txt' -.. method:: bytes.untransform(encoding, errors='strict') - bytearray.untransform(encoding, errors='strict') - - Return an decoded version of the bytes object. This provides the reverse - operation of :meth:`transform`. - - .. versionadded:: 3.2 - - .. staticmethod:: bytes.maketrans(from, to) bytearray.maketrans(from, to) diff --git a/Doc/whatsnew/3.2.rst b/Doc/whatsnew/3.2.rst index 40d5ae2..837a591 100644 --- a/Doc/whatsnew/3.2.rst +++ b/Doc/whatsnew/3.2.rst @@ -406,26 +406,6 @@ Other Language Changes Some smaller changes made to the core Python language are: -* :class:`bytes` and :class:`str` now have two net methods, *transform* and - *untransform*. These provide analogues to *encode* and *decode* but are used - for general purpose str-to-str and bytes-to-bytes transformations rather than - Unicode codecs for bytes-to-str and str-to-bytes. - - Along with the new methods, several non-unicode codecs been restored from Python 2.x - including *base64*, *bz2*, *hex*, *quopri*, *rot13*, *uu*, and *zlib*. - - >>> t = b'which witch had which witches wrist watch' - >>> t.transform('quopri') - b'which=20witch=20had=20which=20witches=20wrist=20watch' - - >>> short = t.transform('zlib_codec') - >>> len(t), len(short) - (41, 38) - >>> short.untransform('zlib_codec') - b'which witch had which witches wrist watch' - - (From multiple contributors in :issue:`7475`.) - * String formatting for :func:`format` and :meth:`str.format` gained new capabilities for the format character **#**. Previously, for integers in binary, octal, or hexadecimal, it caused the output to be prefixed with '0b', |