the peephole optimizer shouldn’t be tasked with “fixing” poorly-written or uncommon code… just improving common code.
As soon as this pattern appears in a benchmark suite we'll optimize it away. :-) (That is, *if* the optimizer can prove that it can't raise a name error.)
--