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
Unexpected error: error: Name "*" already defined in combination with assignment expression and list comprehension.
To Reproduce
Execute mypy on the following snippet:
def func(input: List[int]) -> List[int]:
running_maximum = input[0] if len(input) > 0 else 0
return [running_maximum := max(running_maximum, item) for item in input]
Expected Behavior
Since running_maximum is being returned implicitly during each step in the list comprehension, the assignment expression doesn't hide the value of the initial assignment. Hence, there should be no errors.
Actual Behavior
error: Name "running_maximum" already defined
Your Environment
Mypy version used: 0.910
Python version used: 3.10
Operating system and version: Windows 10
The text was updated successfully, but these errors were encountered:
Bug Report
Unexpected error:
error: Name "*" already defined
in combination with assignment expression and list comprehension.To Reproduce
Execute
mypy
on the following snippet:Expected Behavior
Since
running_maximum
is being returned implicitly during each step in the list comprehension, the assignment expression doesn't hide the value of the initial assignment. Hence, there should be no errors.Actual Behavior
error: Name "running_maximum" already defined
Your Environment
The text was updated successfully, but these errors were encountered: