摘要: 一个看起来非常酷的定义class Example(dict): def __getitem__(self, item): try: return dict.__getitem__(self, item) except KeyError: ... 阅读全文
posted @ 2014-04-20 20:59 LisPythoniC 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 暂时不知为何在控制台多执行一次b()后,del a就不会立即销毁Foo实例.>>> class Foo(object): def __init__(self): self.obj = None print ('created') def __del__(se... 阅读全文
posted @ 2014-04-20 20:52 LisPythoniC 阅读(128) 评论(0) 推荐(0) 编辑