New submission from Serhiy Storchaka <[email protected]>:
You can dispatch on collections.abc.Sequence.
@functools.singledispatch
def f(a: collections.abc.Sequence) -> None:
pass
But MyPy complains about this:
error: Missing type parameters for generic type "Sequence"
MyPy requires parametrized generic (like collections.abc.Sequence[int]), but
singledispatch() does not work with it.
----------
components: Library (Lib)
messages: 409295
nosy: gvanrossum, kj, rhettinger, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Conflict between using annotations in singledispatch() and MyPy
versions: Python 3.10, Python 3.11, Python 3.9
_______________________________________
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