[Zope] inheritance in python product

Stefan H. Holek stefan@epy.co.at
Fri, 07 Jun 2002 19:30:44 +0200


All your classes are derived from ExtensionClass.Base. The problem is to 
call __init__() of a plain (non-EC) base class.

However, what I have posted before works for me:

>>> from ExtensionClass import Base
>>>
>>> class Spam:
...     def __init__(self, name):
...         self.name = name
...
>>> class ECSpam(Base, Spam):
...     def __init__(self, name, color):
...         Spam.__dict__['__init__'](self, name)
...         self.color = color
...
>>> spam = ECSpam('fred', 'blue')
>>> spam.name
'fred'
>>> spam.color
'blue'
>>>

Stefan


--On Freitag, 07. Juni 2002 15:59 +0000 Florent Guillaume <fg@nuxeo.com> 
wrote:

>
> That's weird because I've used it a number of times.
> For instance:
>
>     class PortalContentFolder(PortalFolder, PortalContent,
> DefaultDublinCoreImpl):         #...
>         def __init__(self, id, title='', **kw):
>         DefaultDublinCoreImpl.__init__(self)
>         self.id = id
>         self.title = title
>
> Florent
>
--
BLOWFISH, n. - Preference for beef.