namespaces getting confusing
Mark Robinson
m.1.robinson at herts.ac.uk
Tue Sep 4 07:18:57 EDT 2001
Nope that won't work, because a global is only mapped to the module it
is declared in....this is ugh.
I guess maybe I should go back to sticking it in a class, which I passed
to anything that needed access to it (most things). That seemed
inefficient to me, but it worked so unless anyone can offer a better
modus operandi I'll do that. I can't help but think that this is a
common situation and there is a better way to do it.
blobby
Mark Robinson wrote:
> Thanks guys, I see the problem. Perhaps If I explain why I was trying
> to do that you could suggest a better alternative.
>
> I have a module which basically declares a number of global variables,
> reads some files and basically performs a number of initialisation steps.
>
> Is the best thing to stick all this in the __init__() of a class which I
> declare as global?
More information about the Python-list
mailing list