Odd behaviour on importing variable from module
fredrik at pythonware.com
Sat Aug 23 14:30:56 CEST 2008
> I've found the following behaviour on importing a variable from a
> module somewhat odd. The behaviour is identical in Python 2.5 and
from oddmodule import OddVariable, OddFunction
assigns the *values* of the given module names to new variables in the
importing module's namespace. that is, you're binding new names to the
values the variables happen to have when the from-import statement is
executed. given this, the behaviour should be no more surprising than
A = "value"
B = A
A = "new value"
print B # prints "value"
reading up on how objects and names work in Python could be a good idea;
this page might help:
More information about the Python-list