[docs] [issue36720] Correct Should to Must in Definition of object.__len__

Michal Kononenko report at bugs.python.org
Thu Apr 25 10:52:18 EDT 2019


New submission from Michal Kononenko <michalkononenko at gmail.com>:

The link below defines __len__

https://docs.python.org/3/reference/datamodel.html?highlight=__len__#object.__len__

However, I was reading in the StackOverflow thread below that CPython does some validation to check that the return value of __len__ should be >= 0. Does this mean that len must return a value >= 0, in the RFC 2119 sense of the word?

https://stackoverflow.com/questions/42521449/how-does-python-ensure-the-return-value-of-len-is-an-integer-when-len-is-cal

----------
assignee: docs at python
components: Documentation
messages: 340844
nosy: Michal Kononenko, docs at python
priority: normal
severity: normal
status: open
title: Correct Should to Must in Definition of object.__len__
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36720>
_______________________________________


More information about the docs mailing list