diff options
author | Steve Dower <steve.dower@python.org> | 2019-09-10 14:31:26 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-10 14:31:26 (GMT) |
commit | ed99bb9ca68b37cfaec3629afa67d70289f3ffc7 (patch) | |
tree | 6d78ee273958e49223098616e3b783b43d237128 /Doc/reference | |
parent | 45bc3928e232603a97451dea3106d824b0f7a392 (diff) | |
download | cpython-ed99bb9ca68b37cfaec3629afa67d70289f3ffc7.zip cpython-ed99bb9ca68b37cfaec3629afa67d70289f3ffc7.tar.gz cpython-ed99bb9ca68b37cfaec3629afa67d70289f3ffc7.tar.bz2 |
bpo-37913: document that __length_hint__ can return NotImplemented (GH-15383)
Diffstat (limited to 'Doc/reference')
-rw-r--r-- | Doc/reference/datamodel.rst | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 8813f57..c6c6e40 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -2155,7 +2155,9 @@ through the container; for mappings, :meth:`__iter__` should be the same as 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). - 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 + :const:`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 |