-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
false-positivemypy gave an error on correct codemypy gave an error on correct codefeaturepriority-0-high
Description
As a follow-up to #1174 and #6197, we should perhaps allow two assignments to create independent variables whenever the lifetimes of the variables don't overlap (when using --allow-redefinitions
).
Example:
if foo():
x = 0
print(x)
else:
x = 'a' # Define a new variable?
print(x)
Another example:
for x in [1, 2]:
print(x)
if foo():
for x in ['a', 'b']: # Define a new variable?
print(x)
Naddiseo, henribru, asokoloski, dumblob, ibeex and 30 moregocarlos
Metadata
Metadata
Assignees
Labels
false-positivemypy gave an error on correct codemypy gave an error on correct codefeaturepriority-0-high