Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:
I do not think there is a problem in MyPy. What if use __origin__ for dispatching? Registering with parametrized generics with the same __origin__ will be error. @sigledispatch def f(a: int) -> None: pass @f.register # ok def _(a: list[int]) -> None: pass @f.register # runtime error def _(a: list[str]) -> None: pass @f.register # runtime error def _(a: list) -> None: pass f(1) # ok f([1]) # ok f([]) # ok f(['abc']) # static type checking error I think that it will have advantage of stronger static type checking. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46191> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com