summaryrefslogtreecommitdiff
path: root/Doc/library/stdtypes.rst
diff options
context:
space:
mode:
authorMariatta Wijaya <mariatta.wijaya@gmail.com>2017-02-06 20:16:58 -0800
committerMariatta Wijaya <mariatta.wijaya@gmail.com>2017-02-06 20:16:58 -0800
commitda79bcf8ac7ae72218ab023e1ed54390bc1a3a27 (patch)
tree74845e2dbd9521d9748b9c32f1922f4123083bf3 /Doc/library/stdtypes.rst
parente3c7e835bdfc97750eb9b7fc0ad2493108c2d438 (diff)
parent1fe806ac56f8b83694d24ab604eb695d00bc8497 (diff)
downloadcpython-da79bcf8ac7ae72218ab023e1ed54390bc1a3a27.tar.gz
Issue #29371: merge with 3.5
Diffstat (limited to 'Doc/library/stdtypes.rst')
-rw-r--r--Doc/library/stdtypes.rst27
1 files changed, 18 insertions, 9 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index 71cb7f2643..9a4f42caa4 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -1365,6 +1365,11 @@ objects that compare equal might have different :attr:`~range.start`,
The :attr:`~range.start`, :attr:`~range.stop` and :attr:`~range.step`
attributes.
+.. seealso::
+
+ * The `linspace recipe <http://code.activestate.com/recipes/579000/>`_
+ shows how to implement a lazy version of range that suitable for floating
+ point applications.
.. index::
single: string; text sequence type
@@ -1455,8 +1460,8 @@ multiple fragments.
For more information on the ``str`` class and its methods, see
:ref:`textseq` and the :ref:`string-methods` section below. To output
- formatted strings, see the :ref:`formatstrings` section. In addition,
- see the :ref:`stringservices` section.
+ formatted strings, see the :ref:`f-strings` and :ref:`formatstrings`
+ sections. In addition, see the :ref:`stringservices` section.
.. index::
@@ -2060,8 +2065,8 @@ expression support in the :mod:`re` module).
.. index::
single: formatting, string (%)
single: interpolation, string (%)
- single: string; formatting
- single: string; interpolation
+ single: string; formatting, printf
+ single: string; interpolation, printf
single: printf-style formatting
single: sprintf-style formatting
single: % formatting
@@ -2071,9 +2076,10 @@ expression support in the :mod:`re` module).
The formatting operations described here exhibit a variety of quirks that
lead to a number of common errors (such as failing to display tuples and
- dictionaries correctly). Using the newer :meth:`str.format` interface
- helps avoid these errors, and also provides a generally more powerful,
- flexible and extensible approach to formatting text.
+ dictionaries correctly). Using the newer :ref:`formatted
+ string literals <f-strings>` or the :meth:`str.format` interface
+ helps avoid these errors. These alternatives also provide more powerful,
+ flexible and extensible approaches to formatting text.
String objects have one unique built-in operation: the ``%`` operator (modulo).
This is also known as the string *formatting* or *interpolation* operator.
@@ -2630,8 +2636,8 @@ arbitrary binary data.
The prefix(es) to search for may be any :term:`bytes-like object`.
-.. method:: bytes.translate(table[, delete])
- bytearray.translate(table[, delete])
+.. method:: bytes.translate(table, delete=b'')
+ bytearray.translate(table, delete=b'')
Return a copy of the bytes or bytearray object where all bytes occurring in
the optional argument *delete* are removed, and the remaining bytes have
@@ -2647,6 +2653,9 @@ arbitrary binary data.
>>> b'read this short text'.translate(None, b'aeiou')
b'rd ths shrt txt'
+ .. versionchanged:: 3.6
+ *delete* is now supported as a keyword argument.
+
The following methods on bytes and bytearray objects have default behaviours
that assume the use of ASCII compatible binary formats, but can still be used