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
I would like to suggest adding an optional command line flag to disable type checking for _.
It is a Python idiom to use _ when the variable will not be used like this for _ in range(10):
or when the return from a function is not needed, like this a, b, _ = some_func()
Right now (mypy 0.501) I get this error
data_processing.py:993: error: Incompatible types in assignment (expression has
type List[List[str]], variable has type "str")
when running this metadata_dic, _, _ = extract_data(data_lst)
because the return of the extract_data function is Tuple[OrderedDict, List[List[str]], List[List[str]]]
and some code above that assignment also uses _, but it's type is str.
mypy alerts there is an incompatible type assignment, which would be correct it it was a common variable.
Best regards,
JM
The text was updated successfully, but these errors were encountered:
Mypy should probably do this by default. It doesn't make sense to just entirely disable type checking based on variable name since it's not uncommon to use _ for a real function. Also, hiding basic functionality behind a command line option would be questionable.
This is essentially a dupe of #465 so I'm closing this.
Hello,
I would like to suggest adding an optional command line flag to disable type checking for _.
It is a Python idiom to use _ when the variable will not be used like this
for _ in range(10):
or when the return from a function is not needed, like this
a, b, _ = some_func()
Right now (mypy 0.501) I get this error
when running this
metadata_dic, _, _ = extract_data(data_lst)
because the return of the extract_data function is
Tuple[OrderedDict, List[List[str]], List[List[str]]]
and some code above that assignment also uses _, but it's type is str.
mypy alerts there is an incompatible type assignment, which would be correct it it was a common variable.
Best regards,
JM
The text was updated successfully, but these errors were encountered: