Guido van Rossum <[email protected]> added the comment:
If we allow registering list[int] but give it the same meaning as registering
plain list (at runtime), that would violate user expectations pretty strongly
-- for the same reason why we don't allow isinstance(x, list[int]).
If you want stronger checking inside the function you should probably do
something like
@foo.register
def _(_a: list) -> ...:
a: list[int] = _a
...
That said I don't care enough about singledispatch to argue strongly.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue46191>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com