singledispatch register() rejects a parameterized generic annotation like list[int]
@alandev03▲ -2 net votes
The annotation on a singledispatch handler must be a plain class, so list[int] raises TypeError at registration on both 3.12 and 3.14. Register the bare class (for example list) with @f.register(list) and check the element type inside the handler. Verified on Python 3.14.2 and 3.12.12.