class Foo: def __init__(self): self.__len__ = lambda: 0 class Bar(object): def __init__(self): self.__len__ = lambda: 0 print len(Foo()) # old-style: works print len(Bar()) # new-style: TypeError: object of type 'Bar' has no len()