[issue34499] Extend registering of single-dispatch functions to parametrized generic pseudo-types
Ivan Levkivskyi
report at bugs.python.org
Sat Sep 1 06:18:13 EDT 2018
Ivan Levkivskyi <levkivskyi at gmail.com> added the comment:
TBH, I don't like this idea. Consider this situation:
@singledispatch
def what(x: Iterable) -> None:
print('general case')
@what.register
def _(x: Sequence[int]) -> None:
print('special case')
what(['is', 'going', 'on']) # special case?
Even if you put in the docs that variables are erased etc. people will assume type arguments mean something unless rejected by `singledispatch`. The behaviour you propose can cause confusion.
----------
nosy: +lukasz.langa
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34499>
_______________________________________
More information about the Python-bugs-list
mailing list