Eric Snow added the comment:

Note that (in my mind, unfortunately) the pickle module looks up several
dunder methods on instances.  That isn't quite the same thing since the
issue is about callable not triggering the descriptor protocol.  However it
is closely related.  I point this out because this similar behavior of
pickle is a source of mysterious, hard to understand bugs in many of the
same corner cases.  Thus I'm -1 on changing the behavior of callable.

>From what I understand, the motivation here is in the case of proxies that
dynamically determine their capability and raise AttributeError
accordingly.  If that is the case then consider prior art such as MagicMock
or other existing proxy types on PyPI.

Also consider if there is a proxy-specific approach that can resolve the
matter.  I've long thought there is room in the stdlib for a "proxy" module
that holds proxy-related helpers and classes.

Finally, instead of changing callable, why not use a metaclass that does
the right thing?  I believe MagicMock does something along those lines.

----------
nosy: +eric.snow

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23990>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to