mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
bpo-37913: document that __length_hint__ can return NotImplemented (GH-15383)
This commit is contained in:
parent
17499d8270
commit
009ef2955d
1 changed files with 4 additions and 2 deletions
|
@ -2155,8 +2155,10 @@ through the container; for mappings, :meth:`__iter__` should be the same as
|
||||||
|
|
||||||
Called to implement :func:`operator.length_hint`. Should return an estimated
|
Called to implement :func:`operator.length_hint`. Should return an estimated
|
||||||
length for the object (which may be greater or less than the actual length).
|
length for the object (which may be greater or less than the actual length).
|
||||||
The length must be an integer ``>=`` 0. This method is purely an
|
The length must be an integer ``>=`` 0. The return value may also be
|
||||||
optimization and is never required for correctness.
|
*NotImplemented*, which is treated the same as if the ``__length_hint__``
|
||||||
|
method didn't exist at all. This method is purely an optimization and is
|
||||||
|
never required for correctness.
|
||||||
|
|
||||||
.. versionadded:: 3.4
|
.. versionadded:: 3.4
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue