trouble with scopes and namespaces

Martin von Loewis loewis at informatik.hu-berlin.de
Thu Aug 10 15:48:14 EDT 2000


"Fernando" <frr at mindless.com> writes:

> What's the best way to handle this?  Module (b) can include module (a), but
> not modules (c).  How can I make these variables global to all the modules?
> Passing the variables as parameters to the functions in modyule (b) would be
> a pain because of the number of variables involved...

Python does not have global variables, except when scoped with a
module. So the functions should access and update a.varname all the
time, e.g.

a.varname = a.varname+1

Of course, if the functions are tightly coupled with the variables -
why aren't a and b the same module?

Martin




More information about the Python-list mailing list