You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since the library works by defining the function multiple times, instead of using the same syntax of the singledispatch function, linters show ugly errors. Is there a way to avoid this?
For reference, here is how the singledispatch works:
@singledispatchdeffun(arg, verbose=False):
ifverbose:
print("Let me just say,", end=" ")
print(arg)
@fun.register(int)def_(arg, verbose=False):
ifverbose:
print("Strength in numbers, eh?", end=" ")
print(arg)
@fun.register(list)def_(arg, verbose=False):
ifverbose:
print("Enumerate this:")
fori, eleminenumerate(arg):
print(i, elem)
Notice that there is no need to redefine two times the function fun and no name errors will be shown by linters.
Activity
mrocklin commentedon Jul 18, 2020
It looks like this already works today