PyDocs

Nav

Python Runtime Services

object.__len__

builtins

method of object
  • object.__len__(self)
Called to implement the built-in function len(). Should return the length of the object, an integer >= 0. Also, an object that doesn’t define a __bool__() method and whose __len__() method returns zero is considered to be false in a Boolean context.

The official docs include a CPython implementation detail for this entry.

0 Examples
No examples for builtins/object.__len__.
See Also
No see-alsos for builtins/object.__len__
0 Notes
No notes for object.__len__