Jghost

jeiao, In me the tiger sniffs the rose !

导航

2014年4月2日 #

python -- why defined '__new__' and '__init__' all in a class

摘要: 在学习openstack源码的时候发现一个类里面有'__new__' 和'__init__'两个构造,不知道什么原因,在stackoverflow中找到了满意的解答:粘贴解答至此:You can define either or both of__new__and__init__.__new__must return an object -- which can be a new one (typically that task is delegated totype.__new__), an existing one (to implement singlet 阅读全文

posted @ 2014-04-02 16:00 Jghost 阅读(195) 评论(0) 推荐(0) 编辑