Mar-23-2017, 05:32 PM
(Mar-23-2017, 05:08 PM)zivoni Wrote: You could rewrite__new__()
to "forbid" creation of an object and to do some action, but why would someone sane want to do it ...
In [1]: class foo: ...: def __new__(cls): ...: print("foo") ...: In [2]: foo() foothanks very very much but it works only python3, i use python2 this doesn't work on python2. can you give python2 example of this code ?