Skip to content

Allow variable redefinition if lifetimes don't overlap #6232

Description

@JukkaL

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:

iffoo():
x=0print(x)
else:
x='a'# Define a new variable?print(x)

Another example:

forxin [1, 2]:
print(x)
iffoo():
forxin ['a', 'b']: # Define a new variable?print(x)

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions