[Zope] ExtensionClass

cpita cpita@uol.com.ar
Mon, 20 Mar 2000 16:45:55 -0300


----- Original Message ----- 
From: Jim Fulton <jim@digicool.com>
To: cpita <cpita@uol.com.ar>
Cc: <zope-dev@zope.org>
Sent: Monday, March 20, 2000 4:04 PM
Subject: Re: [Zope] ExtensionClass

> The search order is:
> 
>   1. Instance dictionary
> 
>   2. Class dictionary
> 
>   3. Do depth-first search of base classes from left 
to right.
>   

Suppose that Bi belongs to E (following the previous 
names) and is not, for example, Persistent, and that Bj 
is Persistent (where j > i).
The problem of the getattr (I mean in Persistent) 
invoked only when the attribute being accessed doesn't 
belong to the instance dictionary or class dictionary 
is still here, isn't it?

Carlos

> > Situation:
> > 
> > 1) Class A subclasses 2+ extension classes E =
> > {E1,...,En} and perhaps another non extension 
classes C
> > = {C1,...,Cm}. That is, class A(B1,...,Bk): ...., 
where
> > B1,...,Bk are each in E or in C.
> > 2) a is an instance of A (a = A())
> > 3) a.foo(bar) is invoked
> > 4) getattr is invoked in the first extension class 
in
> > the inherited classes list (i.e. the first Bi 
belonging
> > to E)
> > 
> > Question:
> > 
> > What happens then?
> > I guess that calling Py_FindMethod (inside getattr
> > implementation) will trigger a search in instance 
and
> > base classes' dictionaries, but what about the other
> > extension base classes and what about the searching
> > order?

> OK, let's move this to zope-dev.
> 
> > I can't find any doc on these, so I'm needing your 
help.
> 
> The search order is:
> 
>   1. Instance dictionary
> 
>   2. Class dictionary
> 
>   3. Do depth-first search of base classes from left 
to right.
>   
> In other words, the search order is the same as for 
getattr
> on Python instances, except that some base classes 
can be in C.
> 
> Jim



_________________________________________________________________
UOLMAIL - Todo Argentino tiene derecho a tener su e-mail.
http://www.uolmail.com.ar