breaking up is hard to do

David M. Cooke cookedm+news at physics.mcmaster.ca
Fri Mar 25 17:39:29 EST 2005


"bbands" <bbands at yahoo.com> writes:

> For example I have a class named Indicators. If I cut it out and put it
> in a file call Ind.py then "from Ind import Indicators" the class can
> no longer see my globals. This is true even when the import occurs
> after the config file has been read and parsed.

Don't use globals? Or put all the globals into a separate module,
which you import into Ind and into whatever uses Ind.

Putting the globals into a separate namespace (module, class, class
instance, whatever) also makes it easier to know what is a global :-)

-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca



More information about the Python-list mailing list