[issue23990] Callable builtin doesn't respect descriptors

Maries Ionel Cristian report at bugs.python.org
Fri Apr 17 21:22:38 CEST 2015


Maries Ionel Cristian added the comment:

For context this respects the descriptor protocol:

>>> a()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 4, in __call__
AttributeError: go away

Mind you, this is legal use:

>>> class B:
...  @property
...  def __call__(self):
...   return lambda: 1
...
>>> b = B()
>>> b()
1

----------

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


More information about the Python-bugs-list mailing list