[issue643841] New class special method lookup change
Nick Coghlan
report at bugs.python.org
Tue May 20 16:16:05 CEST 2008
Nick Coghlan <ncoghlan at gmail.com> added the comment:
I've attached a sample ProxyBase class that delegates all of the special
methods handled by weakref.proxy (as well as the tp_oct and tp_hex
slots, which weakref.proxy ignores).
While there are other special methods in CPython (e.g. __enter__ and
__exit__), those don't bypass the normal lookup mechanism, so the
__getattribute__ override should handle them.
For lack of a better name, I called the module typetools (by analogy to
functools).
Note that correctly implementing a proxy class as a new-style class
definitely turns out to be a fairly non-trivial exercise (and since this
one is still sans-tests, I don't make any promises that even it is 100%
correct at this point)
Added file: http://bugs.python.org/file10385/typetools.py
____________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue643841>
____________________________________
More information about the Python-bugs-list
mailing list