diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-02-10 08:50:31 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-10 08:50:31 (GMT) |
commit | 7cc205872dd69bc720b98f0d9fefb752093d656f (patch) | |
tree | e2a03e4e30ae7ff3dabf648c2eda1ceac53e9b03 /Doc/reference | |
parent | 321ec5e0fe87220c5ed5711926bb0212f963e5fd (diff) | |
download | cpython-7cc205872dd69bc720b98f0d9fefb752093d656f.zip cpython-7cc205872dd69bc720b98f0d9fefb752093d656f.tar.gz cpython-7cc205872dd69bc720b98f0d9fefb752093d656f.tar.bz2 |
[3.12] gh-114552: Update `__dir__` method docs: it allows returning an iterable (GH-114662) (#115234)
gh-114552: Update `__dir__` method docs: it allows returning an iterable (GH-114662)
(cherry picked from commit e19103a346f0277c44a43dfaebad9a5aa468bf1e)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Diffstat (limited to 'Doc/reference')
-rw-r--r-- | Doc/reference/datamodel.rst | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index fcb65b8..a9ce0f4 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1983,8 +1983,8 @@ access (use of, assignment to, or deletion of ``x.name``) for class instances. .. method:: object.__dir__(self) - Called when :func:`dir` is called on the object. A sequence must be - returned. :func:`dir` converts the returned sequence to a list and sorts it. + Called when :func:`dir` is called on the object. An iterable must be + returned. :func:`dir` converts the returned iterable to a list and sorts it. Customizing module attribute access @@ -2004,7 +2004,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 sequence of +The ``__dir__`` function should accept no arguments, and return an iterable of strings that represents the names accessible on module. If present, this function overrides the standard :func:`dir` search on a module. |