By Google Python style guide, one disadvantage of using global variables is this:
"Has the potential to change module behavior during the import, because assignments to module-level variables are done when the module is imported".
My understanding to the sentence is, "the module level variables of the imported module A
effect the behavior of module B
which imports module A
", is this semantically correct?
If it is, any module level variable var in A
can only be accessed in B
by A.var
. I don't get why importing A
would change the behavior of B
.
If I misunderstand the sentence, what is the correct interpretation?
Thanks!