[Python-Dev] 'hasattr' is broken by design (original) (raw)

Michael Foord fuzzyman at voidspace.org.uk
Wed Sep 1 17:34:59 CEST 2010


On 25 August 2010 20:57, P.J. Eby <pje at telecommunity.com> 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,

Michael Foord

-- http://www.voidspace.org.uk -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20100901/95182dfb/attachment.html>



More information about the Python-Dev mailing list