class AClass(object): def __init__(self): self._list = [1,2,3] def __len__(self): return len(self._list)a=AClass()print(a.__len__()) # 3print(len(a)) # 3
No comments:
Post a Comment