trouble with scopes and namespaces
Emile van Sebille
emile at fenx.com
Thu Aug 10 13:17:21 EDT 2000
But you'll probably want to avoid that name unless
you intend to override the built-in function.
--
Emile van Sebille
emile at fenx.com
-------------------
"William Dandreta" <wjdandreta at worldnet.att.net> wrote in
message
news:4RAk5.5822$4T.341263 at bgtnsc07-news.ops.worldnet.att.net
...
> 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