[Zope3-dev] zope3-dev proposal on changing implicitly calling
Chris Withers
chrisw@nipltd.com
Tue, 05 Aug 2003 10:54:30 +0100
Steve Alexander wrote:
> UTSL :-)
I'm hoping to get back into Zope 3 some time soon, in the meantime, that don't
help me much ;-)
> Ok, I'll save you looking at the code:
>
> if getattr(r, '__class__', 0) == MethodType:
> return r()
Oooo... is that a Python 2.3 ism?
Shouldn't it be:
if isintance(r,MethodType):
return r()
?
> Like I said, at this point, the calling behaviour applies only to the
> default traversable adapter, and only to methods.
But, for the default traverser, it applies to all segments, not just the last
one? If so, cool :-)
> Why would you want to do something different than the traversable
> adapter for the objects you are traversing?
Well, do all object implement traversable adapters? I would haev thought most
would just use the default traverser? In that case, wouldn't you need to
implemetn a traverser if you wanted traversal from that object to the next name
in the path to not have the result of traversing that name being called?
>> ...so you'd have to write a specia ltraverse in this case?
>
> If you have special traversal requirements for particular objects, you
> can write a special traversable adapter that knows how to traverse those
> objects.
:-)
Chris