Nick Coghlan <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>
<http://bugs.python.org/issue643841>
____________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to