[issue643841] New class special method lookup change

Nick Coghlan report at bugs.python.org
Sat May 24 02:26:13 CEST 2008


Nick Coghlan <ncoghlan at gmail.com> added the comment:

The way to override _deref/_unwrap is to make _target a property on a
ProxyMixin  subclass (which reminds me, I want to put in an explicit
test case to make sure that works as intended - I'll use the
weakref-proxy-in-Python as the example, so I'll also need to fix the
docs to indicate that such a thing doesn't actually require rewriting
the whole class). 

And there are a lot more use cases than just the ones you listed,
primarily in the area of interface adaptation (i.e. the programmer just
wants to fiddle with the visible API of the object a bit, rather than
doing anything clever with the way the proxy's target is referenced).

The reason I'm wary of attempting to provide direct support for the
distributed communications use case, is that distributed computing needs
to deal with all sorts of issues in relation to serialisation and
transport of arguments and return values, that a local proxy of any kind
simply doesn't have to deal with (since it can just pass direct
references around). Note that merely diverting everything through
__getattribute__ isn't even close to enough, due to the argument and
return value transport problem - the RPC mechanism needs to understand
the methods that are being invoked as well. So I'm quite happy leaving
all those issues to tools that are actually designed to handle them
(CORBA, XML-RPC, etc).

____________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue643841>
____________________________________


More information about the Python-bugs-list mailing list