Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-25866: Minor cleanups to "sequence" in docs #17177

Merged
merged 3 commits into from
Nov 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions Doc/reference/datamodel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,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.

Expand Down Expand Up @@ -1797,6 +1797,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
Expand Down Expand Up @@ -2128,8 +2132,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)

Expand Down Expand Up @@ -2243,9 +2247,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)

Expand Down