This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Recipients AlexWaygood, gvanrossum, kj, lukasz.langa, rhettinger, serhiy.storchaka
Date 2021-12-29.23:58:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1640822333.72.0.0968909819831.issue46191@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-12-29 23:58:53gvanrossumsetrecipients: + gvanrossum, rhettinger, lukasz.langa, serhiy.storchaka, kj, AlexWaygood
2021-12-29 23:58:53gvanrossumsetmessageid: <1640822333.72.0.0968909819831.issue46191@roundup.psfhosted.org>
2021-12-29 23:58:53gvanrossumlinkissue46191 messages
2021-12-29 23:58:53gvanrossumcreate