10 Oct
2021
10 Oct
'21
5:26 p.m.
I can think of two reasons. The first reason is that this operation *does* have a side-effect: if a fast local is unbound, the load will raise a NameError! def f(): x # This should always raise. x = None # This makes x a fast local. The second reason is one that Guido already alluded to: the peephole optimizer shouldn’t be tasked with “fixing” poorly-written or uncommon code… just improving common code. If anything, we would probably just warn here. But even that seems like too much. Brandt