Skip to content

Commit 72321c7

Browse files
miss-islingtonalclarks
authored andcommitted
bpo-25866: Minor cleanups to "sequence" in docs (GH-17177) (GH-17209)
(cherry picked from commit 4544e78) Co-authored-by: alclarks <[email protected]>
1 parent 8a334af commit 72321c7

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Doc/reference/datamodel.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,7 +1563,7 @@ not found on a module object through the normal lookup, i.e.
15631563
the module ``__dict__`` before raising an :exc:`AttributeError`. If found,
15641564
it is called with the attribute name and the result is returned.
15651565

1566-
The ``__dir__`` function should accept no arguments, and return a list of
1566+
The ``__dir__`` function should accept no arguments, and return a sequence of
15671567
strings that represents the names accessible on module. If present, this
15681568
function overrides the standard :func:`dir` search on a module.
15691569

@@ -1783,6 +1783,10 @@ Notes on using *__slots__*
17831783
(the other bases must have empty slot layouts) - violations raise
17841784
:exc:`TypeError`.
17851785

1786+
* If an iterator is used for *__slots__* then a descriptor is created for each
1787+
of the iterator's values. However, the *__slots__* attribute will be an empty
1788+
iterator.
1789+
17861790
.. _class-customization:
17871791

17881792
Customizing class creation
@@ -2115,8 +2119,8 @@ operators. It is recommended that both mappings and sequences implement the
21152119
mappings, ``in`` should search the mapping's keys; for sequences, it should
21162120
search through the values. It is further recommended that both mappings and
21172121
sequences implement the :meth:`__iter__` method to allow efficient iteration
2118-
through the container; for mappings, :meth:`__iter__` should be the same as
2119-
:meth:`keys`; for sequences, it should iterate through the values.
2122+
through the container; for mappings, :meth:`__iter__` should iterate
2123+
through the object's keys; for sequences, it should iterate through the values.
21202124

21212125
.. method:: object.__len__(self)
21222126

@@ -2230,9 +2234,9 @@ through the container; for mappings, :meth:`__iter__` should be the same as
22302234

22312235

22322236
The membership test operators (:keyword:`in` and :keyword:`not in`) are normally
2233-
implemented as an iteration through a sequence. However, container objects can
2237+
implemented as an iteration through a container. However, container objects can
22342238
supply the following special method with a more efficient implementation, which
2235-
also does not require the object be a sequence.
2239+
also does not require the object be iterable.
22362240

22372241
.. method:: object.__contains__(self, item)
22382242

0 commit comments

Comments
 (0)