On 25 August 2010 20:57, P.J. Eby firstname.lastname@example.org wrote:
[snip...] As you can see, the __call__ attribute in each case is whatever the proxied object's __call__ attribute is, even though the proxy itself has a __call__ method, that is invoked when the proxy is called.
This is actually pretty straightforward stuff since the introduction of __getattribute__.
(The code is at http://pypi.python.org/pypi/ProxyTypes, btw.)
For what it's worth this code is useful enough (and simple enough) that I would support its inclusion in the standard library. I've written proxy objects several times (for various different purposes) and this would have saved me the effort. :-)
All the best,