Nick Coghlan <[EMAIL PROTECTED]> added the comment:

Unfortunately, the standard library doesn't tend to do this kind of
delegation (aside from weakref.proxy, which implements the equivalent
code directly in C), so there isn't a lot of standard library code that
will benefit from it directly.

However, maintaining such a class on PyPI is also fairly undesirable,
due to the extremely tight coupling between the list of methods it needs
to delegate explicitly and the tp_* slots in the PyType method
definitions - add a new tp_* slot, and it's necessary to add the same
methods to the proxy class. Different Python implementations are going
to have different needs as to which slots they have to delegate
explicitly, and which can be left to the __getattribute__ catch-all
delegation.

As far as adding a module for a single class goes, I wouldn't expect it
to remain that way forever. E.g., I'd hope to eventually see a
CallableMixin that defined __get__ the same way a function does, making
it easier to create callables that behave like functions when stored as
a class attribute.

That said, I'd be happy enough with adding the ProxyMixin to the types
module instead, but I thought we were still trying to get rid of that
module.

_______________________________________
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

Reply via email to