[Zope-dev] Extension class and __init__

Dieter Maurer dieter@handshake.de
Sun, 28 Jul 2002 23:27:48 +0200


Ross Boylan writes:
 > The example there is basically
 > class Spam:
 >   def __init__(self):
 >     ...
 > 
 > class ECSpam(Base, Spam):  #Base is an ExtensionClass
 >   def __init__(self):
 >     ECSpam.inheritedAttribute('__init__')(self)
I started to use the following idiom:

  class ECSpam(...,Spam): ...
    _Spam__init= Spam.__init__

    def __init__(self):
      self._Spam__init()

i.e., rename the overloaded method in you derived class and call
it in the normal way with its new name.


Dieter