Skip to content

Commit 20a4f6c

Browse files
miss-islingtonalclarks
authored andcommitted
bpo-25866: Minor cleanups to "sequence" in docs (GH-17177) (GH-17208)
(cherry picked from commit 4544e78) Co-authored-by: alclarks <57201106+alclarks@users.noreply.github.com>
1 parent 1fe79a4 commit 20a4f6c

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
@@ -1566,7 +1566,7 @@ not found on a module object through the normal lookup, i.e.
15661566
the module ``__dict__`` before raising an :exc:`AttributeError`. If found,
15671567
it is called with the attribute name and the result is returned.
15681568

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

@@ -1797,6 +1797,10 @@ Notes on using *__slots__*
17971797
(the other bases must have empty slot layouts) - violations raise
17981798
:exc:`TypeError`.
17991799

1800+
* If an iterator is used for *__slots__* then a descriptor is created for each
1801+
of the iterator's values. However, the *__slots__* attribute will be an empty
1802+
iterator.
1803+
18001804
.. _class-customization:
18011805

18021806
Customizing class creation
@@ -2128,8 +2132,8 @@ operators. It is recommended that both mappings and sequences implement the
21282132
mappings, ``in`` should search the mapping's keys; for sequences, it should
21292133
search through the values. It is further recommended that both mappings and
21302134
sequences implement the :meth:`__iter__` method to allow efficient iteration
2131-
through the container; for mappings, :meth:`__iter__` should be the same as
2132-
:meth:`keys`; for sequences, it should iterate through the values.
2135+
through the container; for mappings, :meth:`__iter__` should iterate
2136+
through the object's keys; for sequences, it should iterate through the values.
21332137

21342138
.. method:: object.__len__(self)
21352139

@@ -2243,9 +2247,9 @@ through the container; for mappings, :meth:`__iter__` should be the same as
22432247

22442248

22452249
The membership test operators (:keyword:`in` and :keyword:`not in`) are normally
2246-
implemented as an iteration through a sequence. However, container objects can
2250+
implemented as an iteration through a container. However, container objects can
22472251
supply the following special method with a more efficient implementation, which
2248-
also does not require the object be a sequence.
2252+
also does not require the object be iterable.
22492253

22502254
.. method:: object.__contains__(self, item)
22512255

0 commit comments

Comments
 (0)