xif
public python v1 · immutableclass Foo: def __init__(self): self.__len__ = lambda: 0class Bar(object): def __init__(self): self.__len__ = lambda: 0print len(Foo()) # old-style: worksprint len(Bar()) # new-style: TypeError: object of type 'Bar' has no len()