Search notes:

Python: __len__

A sequence type is required to implement __len__(), __getitem__() and __iter__().

See also

The built-in function len()
The __len__ method is used to determine if an object is considered to be True or False when it is evaluated in boolean context and the object does not have a __bool__ method.
Other dunders

Index