After reading at Python - Visibility of global variables in imported modules
I was curious about this example:
import shared_stuff
import module1
shared_stuff.a = 3
module1.f()
If there are no other variables "a" anywhere else, why the following one is not equivalent?
from shared_stuff import *
import module1
a = 3
module1.f()
We leave out "explicit is better than implicit": I am asking out of curiosity, as I prefer the first syntax anyway. I come from C and it looks like I didn't fully grasp Python's namespace's subtleties. Even a link to docs where this namespace's behaviour is explained is enough.