Message409336
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. |
|
Date |
User |
Action |
Args |
2021-12-29 23:58:53 | gvanrossum | set | recipients:
+ gvanrossum, rhettinger, lukasz.langa, serhiy.storchaka, kj, AlexWaygood |
2021-12-29 23:58:53 | gvanrossum | set | messageid: <1640822333.72.0.0968909819831.issue46191@roundup.psfhosted.org> |
2021-12-29 23:58:53 | gvanrossum | link | issue46191 messages |
2021-12-29 23:58:53 | gvanrossum | create | |
|