[Zope3-dev] ContextMethod / Wrapper questions...

Jim Fulton jim@zope.com
Fri, 27 Dec 2002 10:12:37 -0500


Jim Fulton wrote:

...

>> Ok. It would be really nice if a wrapper instance could somehow be 
>> clever, and implement only those C-level slots that the object it 
>> wraps implements. So, callable(foo) would work properly, and there 
>> won't be any subtle surprises on whether __len__ or __nonzero__, or 
>> __iter__ or __getitem__ get called for a wrapped object.
>>
>> This works for __call__ and __getitem__ in the current python 
>> implementation.
>>
>> At the Sprintathon, I had a talk with Guido about how to go about 
>> doing this. However, I don't speak much C, so the details escape me. 
>> Jim also had a suggestion about this, and again, I didn't understand 
>> the details :-)
> 
> 
> I really think that this is a lot of bother and not really worth it.

We should pursue a different approach.

We should implement fast proxy introspection routines in C. This is now
possible since Fred has made our proxies have a common base class.

Maybe we can go over this together, since you work 20 feet from me. :)

Also, it would be nice to have a ContextAware mix-in that causes all
descriptors to be context descriptors.

In fact, I'm finding that most objects that have *any* context methods
would be happier to have all methods be context methods.

Jim


-- 
Jim Fulton           mailto:jim@zope.com       Python Powered!
CTO                  (888) 344-4332            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org