This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients PiDelport, Rhamphoryncus, barry, georg.brandl, jcea, jkrukoff, ncoghlan, terry.reedy
Date 2008-06-11.12:51:49
SpamBayes Score 0.0006333786
Marked as misclassified No
Message-id <1213188710.71.0.782645984813.issue643841@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2008-06-11 12:51:51ncoghlansetspambayes_score: 0.000633379 -> 0.0006333786
recipients: + ncoghlan, barry, georg.brandl, terry.reedy, jcea, Rhamphoryncus, jkrukoff, PiDelport
2008-06-11 12:51:50ncoghlansetspambayes_score: 0.000633379 -> 0.000633379
messageid: <1213188710.71.0.782645984813.issue643841@psf.upfronthosting.co.za>
2008-06-11 12:51:50ncoghlanlinkissue643841 messages
2008-06-11 12:51:49ncoghlancreate