any ways to judge whether an object is initilized or not in a class

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Mon Mar 19 16:00:07 EDT 2007


Steve Holden a écrit :
> Bruno Desthuilliers wrote:
> 
>> Diez B. Roggisch a écrit :
>>
(snip)
>>> You want boil to be called __init__, which is python's constructor name. 
>>
>> <nitpicking>
>> Actually, __init__ is the initializer. The proper constructor is __new__.
>> </nitpicking>
>>
> <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.

Yes, true.

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 mailing list