The 1.0-1.4 rule is very simple:
- functions, loops, try blocks, structs, and comprehensions introduce local scope blocks
- when you see
x = ...
in a local scope:- if
x
is already a local, it assigns it - otherwise it creates a new local
x
- if
Is some part of this rule unclear? Or do you just find the result to be not what you’re used to? Intuitiveness and simplicity are often at odds with one another. Or put another way, mechanisms that humans find intuitive are often surprisingly complex and subtle.