[Python-checkins] bpo-25866: Minor cleanups to "sequence" in docs (GH-17177) (GH-17209)

Raymond Hettinger webhook-mailer at python.org
Sun Nov 17 17:07:52 EST 2019


https://github.com/python/cpython/commit/72321c7be096434e3343bd5b37a4436aa9eea098
commit: 72321c7be096434e3343bd5b37a4436aa9eea098
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Raymond Hettinger <rhettinger at users.noreply.github.com>
date: 2019-11-17T14:07:48-08:00
summary:

bpo-25866: Minor cleanups to "sequence" in docs (GH-17177) (GH-17209)

(cherry picked from commit 4544e78ec4558b75bf95e5b7dfc1b5bbb07ae5f0)

Co-authored-by: alclarks <57201106+alclarks at users.noreply.github.com>

files:
M Doc/reference/datamodel.rst

diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index f5e23d85b9d86..835db9224cc74 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -1563,7 +1563,7 @@ not found on a module object through the normal lookup, i.e.
 the module ``__dict__`` before raising an :exc:`AttributeError`. If found,
 it is called with the attribute name and the result is returned.
 
-The ``__dir__`` function should accept no arguments, and return a list of
+The ``__dir__`` function should accept no arguments, and return a sequence of
 strings that represents the names accessible on module. If present, this
 function overrides the standard :func:`dir` search on a module.
 
@@ -1783,6 +1783,10 @@ Notes on using *__slots__*
   (the other bases must have empty slot layouts) - violations raise
   :exc:`TypeError`.
 
+* If an iterator is used for *__slots__* then a descriptor is created for each
+  of the iterator's values. However, the *__slots__* attribute will be an empty
+  iterator.
+
 .. _class-customization:
 
 Customizing class creation
@@ -2115,8 +2119,8 @@ operators.  It is recommended that both mappings and sequences implement the
 mappings, ``in`` should search the mapping's keys; for sequences, it should
 search through the values.  It is further recommended that both mappings and
 sequences implement the :meth:`__iter__` method to allow efficient iteration
-through the container; for mappings, :meth:`__iter__` should be the same as
-:meth:`keys`; for sequences, it should iterate through the values.
+through the container; for mappings, :meth:`__iter__` should iterate
+through the object's keys; for sequences, it should iterate through the values.
 
 .. method:: object.__len__(self)
 
@@ -2230,9 +2234,9 @@ through the container; for mappings, :meth:`__iter__` should be the same as
 
 
 The membership test operators (:keyword:`in` and :keyword:`not in`) are normally
-implemented as an iteration through a sequence.  However, container objects can
+implemented as an iteration through a container. However, container objects can
 supply the following special method with a more efficient implementation, which
-also does not require the object be a sequence.
+also does not require the object be iterable.
 
 .. method:: object.__contains__(self, item)
 



More information about the Python-checkins mailing list