trouble with scopes and namespaces
William Dandreta
wjdandreta at worldnet.att.net
Thu Aug 10 12:35:12 EDT 2000
Hi Fernando,
You could put the variables in a class like so:
class globals:
self.x = 7
self.y = 12
etc.
def __init__(self,etc):
do whatever to initialize, maybe nothing
variables = globals(..)
variables.x = 6
print variables.y
etc.
Bill
Fernando wrote in message ...
>Hi!
>
> I have this situation:
>
>a) A module with MANY variables in it.
>b) Another module with many functions that operate on these variables
>c) n Modules that may or not (usually will) modify the value of some of
the
>variables in module (a) and then call some of the functions in module (b)
>(using the update values).
>
>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...
>
>TIA
>
>
More information about the Python-list
mailing list