[issue40298] Type annotation objects (Tuple, List, etc.) register as callable()

Serhiy Storchaka report at bugs.python.org
Thu Apr 16 04:49:32 EDT 2020


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

It is not a bug. Tuple is a callable, but calling it raises a TypeError with the informative error message.

It does not differ from e.g.

>>> def foo():
...     raise TypeError("don't call foo()")
... 
>>> callable(foo)
True
>>> foo()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 2, in foo
TypeError: don't call foo()

----------
nosy: +serhiy.storchaka
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40298>
_______________________________________


More information about the Python-bugs-list mailing list