class NoLenSupport:
pass
>>> obj = NoLenSupport()
>>> len(obj)
TypeError: "object of type 'NoLenSupport' has no len()"
class LenSupport:
def __len__(self):
return 42
>>> obj = LenSupport()
>>> len(obj)
42
__repr__
__str__
__len__
-__getitem__
-__reversed__
-__eq__
__lt__
__add__
__call__
__enter__
__exit__