I\'ve come across some very odd handling of global variables in Python. I was hoping someone can explain and justify these surprises!
A) This code prints 10 as expec
The second instance rebinds a, so the compiler generates a local access for it. The other two only read a, and so normal global scope searching is performed.
a