[issue42195] Inconsistent __args__ between typing.Callable and collections.abc.Callable
Shantanu
report at bugs.python.org
Sun Nov 29 21:25:13 EST 2020
Shantanu <hauntsaninja at gmail.com> added the comment:
You're right that Callable[[P], int] is invalid, so a flat representation isn't currently ambiguous. But a flat representation would foist the responsibility for checking that to all users of `__args__`. If your code isn't ParamSpec aware, your failures will probably be less obvious or even silent.
The flat representation trades off a) implementation complexity with b) usability / aesthetics, c) future proof-ness. I'm not morally opposed to such a tradeoff / am happy to defer to people with more experience in making such tradeoffs.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42195>
_______________________________________
More information about the Python-bugs-list
mailing list