Closed
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)