[Zope] inheritance in python product
Dieter Maurer
dieter@handshake.de
Sun, 9 Jun 2002 08:03:31 +0200
Sylvain =3D?iso-8859-1?Q?Th=3DE9nault?=3D writes:
> On Thursday 06 June =E0 11:59, Chris McDonough wrote:
> > See the description of "inheritedAttribute" in this document:
> ok, I see my problem now. However, this document says it can be resolv=
ed
> with the inheritedAttribute class method but without talking about
> multiple inheritance.
The problem only occurs when you try to call a method inherited from
a plain Python class (and not an ExtensionClass) from an
ExtensionClass object (more precisely, pass an ExtensionClass object
as "self" argument). You can safely use the standard way
"klass.method(self,...)", when "klass" is itself an extension class.
That said, you can use the following work around:
Wrap your plain Python class into an ExtensionClass and
use that for explicitely calling the methods:
class myPlainPythonClass:
...
from ExtensionClass import Base
class myWrappedPythonClass(Base,myPlainPythonClass): pass
Of couse, you can give the wrapped class the same name as the
plain class in order to minimize modifications of your code.
Dieter