any ways to judge whether an object is initilized or not in a class
bdesth.quelquechose at free.quelquepart.fr
Mon Mar 19 21:00:07 CET 2007
Steve Holden a écrit :
> Bruno Desthuilliers wrote:
>> Diez B. Roggisch a écrit :
>>> You want boil to be called __init__, which is python's constructor name.
>> Actually, __init__ is the initializer. The proper constructor is __new__.
> <nitpicking severity="be-kind-to-novices">
I'm not sure Diez qualifies as a "novice". And since the OP makes
reference to C++, I assume he's able to grasp the difference between a
constructor and an initializer.
> Actually you would have to ensure that the class's metaclass was <type
> "type"> for that to be true. Classic classes don't *have* a __new__ method.
Fact is I stopped using old-style classes some years ago, so I don't
really remember what features they were missing. Thanks for the correction.
More information about the Python-list