the global keyword:

Random832 random832 at fastmail.com
Sun Jun 12 14:46:55 EDT 2016


On Sat, Jun 11, 2016, at 23:15, Lawrence D’Oliveiro wrote:
> On Sunday, June 12, 2016 at 11:51:11 AM UTC+12, Random832 wrote:
> > Importing a variable from a module copies its value into your own
> > module's variable.
> 
> Every name in Python is a variable, and can be assigned to to change its
> value at any time.

Sure, but that doesn't really help explain this situation, since your
statement doesn't make clear the fact that by importing foo.a into bar
you are really merely assigning to bar.a rather than having continuous
access to foo.a, unlike how importing things works in static languages.



More information about the Python-list mailing list