[Tutor] quick query relating to globals (I think)

alan.gauld@bt.com alan.gauld@bt.com
Mon, 24 Jun 2002 17:53:31 +0100


> >   Hmm...just a sec, if thing.py initialised it's own 
> > instance of thing, at the global level, then could 
> > one.py and two.py do an 'import thing' and access 
> > it with thing.thing?
> 
> ...modules are cached and loaded only once, 
> we're guaranteed that that instance will be
> instantiated only once.

Oops, I'd forgotten about that little feature.
So yes you could do this. Its still a really bad idea to 
have code in one module dependant on the existence of 
an instance in another module however.

Alan g.