Quoting Max Noel <[EMAIL PROTECTED]>:

>       I'm not absolutely confident with inheritance in Python (nearly all of
> my serious OO work has been in Java), but shouldn't the call to the 
> superclass's constructor be the very first statement of the subclass's 
> constructor?

No ...

Or, well, maybe --- but __init__ is technically not the constructor.

The constructor is responsible for doing the nitty gritty work of constructing
an object, which is, I guess, why you feel it should be called first (because
you don't want to be messing with an object that does not fully exist yet).

But in python, by the time __init__ is called, the object has been fully
constructed.  __init__ is just a special method that gets called immediately
after construction.  But otherwise, there is nothing special or magical about 
it.

You could even do this if you wanted:

class myClass(object):
 ...
 def reInitialise(self):
  self.__init__()

although I'm not sure if this would be considered good practice :-)

[as to the original question --- someone else will have to answer, sorry, 'cause
I don't know]

-- 
John.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to