[Zope] inheritedAttribute search order

Ken Whitesell kwhitesell at adelphia.net
Mon Oct 27 20:48:59 EST 2003


Ooh, ooh, I know the answer to this one!!!

Per the Python 2.3.2 documentation, Section 9.5.1, it's a 
depth-first, left to right resolution.

In this case, it's Base1 -> Base2 -> Base3

If Base1 is a subclass of Base0, then it's
Base1 -> Base0 -> Base2 -> Base3

Ken

> Date: Mon, 27 Oct 2003 17:19:01 +0100
> From: "Gilles Lenfant" <gilles at pilotsystems.net>
> Subject: [Zope] inheritedAttribute search order
> To: <zope at zope.org>
> Message-ID: <052d01c39ca6$085ea370$0301a8c0 at provence>
> Content-Type: text/plain;	charset="iso-8859-1"
> 
> Hi,
> 
> Given such a situation...
> 
> class MyClass(Base1, Base2, Base3):
>     ...
>     def foo(self, arg1, arg2):
>         """ """
>         x = ...
>         y = ...
>         ...
>         z = MyClass.inheritedAttribute('foo')(self, x, y)
>         ...
> 
> In the case where more than one base class has a "foo" method/attribute, in
> what order does inheritedAttribute() search that "foo" attribute ?
> 
> Base1 -> Base2 -> Base3 ?
> Base3 -> Base2 -> Base1 ?
> Other ?
> 
> Many thanks in advance.
> 
> --





More information about the Zope mailing list