Nick Coghlan <[EMAIL PROTECTED]> added the comment: And (mainly for Barry's benefit) a quick recap of why I think this is necessary for Python 3.0:
For performance or correctness reasons, the interpreter is permitted to bypass the normal __getattribute__ when looking up special methods such as __print__ or __index__. Whether or not the normal attribute lookup machinery is bypassed for a specific special method is an application independent decision. In CPython's case, this bypassing can occur either because there is a tp_* slot dedicated to the method, or because the interpreter uses Py_TYPE(obj) and _PyType_Lookup instead of PyObject_GetAttr to find the method implementation (or type(obj).meth instead of obj.meth for special method lookups implemented in Python code). This behaviour creates a problem for value-based delegation such as that provided by weakref.proxy: unlike overriding __getattr__ on a classic class, merely overriding __getattribute__ on a new-style class instance is insufficient to be able to correctly delegate all of the special methods. The intent of providing a typetools.ProxyMixin (or alternatively a types.ProxyMixin class) is to allow fairly simply conversion of classic classes that implement value-based delegation to new-style classes by inheriting from ProxyMixin rather than inheriting from object directly. Given the close proximity of the beta perhaps I should PEP'ify this to get a formal yea or nay from Guido? I haven't managed to get much response to previous python-dev posts about it. _______________________________________ Python 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