-
-
Notifications
You must be signed in to change notification settings - Fork 408
Closed as not planned
Labels
rule requestAdding a new ruleAdding a new rule
Description
Rule request
Thesis
We can create generator expression that produce a different result from what we expect.
>>> a = 1
>>> b = (a * i for i in range(5))
>>> a = 2
>>> print(list(b))
[0, 2, 4, 6, 8]
Link: https://twitter.com/asmeurer/status/1371952741728194561
Reasoning
Comprehensions like this should be safe. We should not be able to reassign values that comprehensions rely on.
Metadata
Metadata
Assignees
Labels
rule requestAdding a new ruleAdding a new rule