> Don’t count on your operator overloads to work here, though.
> by keeping these variables around, debugging is more straightforward
The transformations the author is suggesting are not in general legal. Missing operator overloads and inconsistent debugging states aren’t something to gloss over - they’re showing you your optimisations are just wrong!
You would need a sophisticated deoptimisation system with frame states, like JVMs or V8 has, to make them legal.
The Python compiler isn’t dumb - it’s correct.