Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
>>> class A(object): pass
>>> a = A()
>>> a.__len__ = lambda: 3
>>> a.__len__()
>>> len(a)
Traceback (most recent call last):
TypeError: object of type 'A' has no len()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment