[Python-Dev] Making proxy types easier to write and maintain (original) (raw)

Eric Snow ericsnowcurrently at gmail.com
Mon Mar 31 20:53:17 CEST 2014


On Wed, Mar 19, 2014 at 12:46 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:

In http://bugs.python.org/issue19359#msg213530 I proposed to introduce a "proxy protocol" (proxy / tpproxy) that would be used as a fallback by PyObjectLookupSpecial to fetch the lookup target, i.e.:

def PyObjectLookupSpecial(obj, name): tp = type(obj) try: return getattr(tp, name) except AttributeError: return getattr(tp.tpproxy(), name) What do you think?

Regardless of the attr lookup in the interpreter, it would be nice to have a standardized explicit proxied attribute on proxy objects (similar to wrapped).

-eric



More information about the Python-Dev mailing list