[issue23990] Callable builtin doesn't respect descriptors

R. David Murray report at bugs.python.org
Mon Apr 20 15:17:23 CEST 2015


R. David Murray added the comment:

The only 'consistency' fix that would make any sense, IMO, would be to disallow special methods to be descriptors.  We can't do that for backward compatibility reasons, so that's pretty much case closed.

Eric already mentioned one of the other 'capability' helpers:

rdmurray at pydev:~/python/p35>./python 
Python 3.5.0a3+ (default:5612dc5e6af9+, Apr 16 2015, 11:29:58) 
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo:
...     @property
...     def __iter__(self):
...         raise AttributeError
... 
>>> f = Foo
>>> from collections.abc import Iterable
>>> issubclass(Foo, Iterable)
True

----------
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23990>
_______________________________________


More information about the Python-bugs-list mailing list