Wildemar Wildenburger <[EMAIL PROTECTED]> writes: > Jeroen Ruigrok van der Werven wrote: >> To restate it more correctly: __init__ is akin to a constructor. >> > No. See Hrvoje Niksic's reply (and Ben Finney's to which it was a > reply). > > __init__() /initializes/ an instance (automatically after > creation). It is called, /after/ the instance has been constructed
I don't understand the purpose of this "correction". After all, __init__ *is* the closest equivalent to what other languages would call a constructor. Take C++ and Java, the two most popular OO languages in existence. Their constructors also "initialize" an instance -- the actual allocation is left to the caller (new or stack in C++) or to the garbage collector. They even share with Python the convention of not returning the constructed value, they operate purely on side effect, just like Python's __init__. And yet, no one says that they are somehow not constructors because of that. Wikipedia calls the constructor "a special method used in object oriented programming which puts the object's members into a valid state." Again, exactly what __init__ does. -- http://mail.python.org/mailman/listinfo/python-list