[Tutor] Calling ancestors __init__

alan.gauld@bt.com alan.gauld@bt.com
Mon, 9 Oct 2000 17:40:11 +0100

> The beauty of OO programming is the ability to let the parent 
> to it's own
> setup. In Smalltalk this is super (arguments)

I guess you could fake this (a bit) in Python by:

class Foo(Bar):
   super = Bar
   def __init__(self):
      # do something
   def doit(self):
      # do the polymorphic thing

> How do I do that in Python? Currently I call from the child object:
> ancestor.__init__ (args)

That's the usual way, it does mean that if you change the 
superclass you have to change all the calls to it, whereas 
the self.super technique means only one change - otherwise 
there's no advantage.

Alan G.