Is global really global.
Erik Wilsher
erik.wilsher at iname.com
Fri Oct 27 03:24:39 EDT 2000
--- In python-list at egroups.com, Steve Juranich <sjuranic at c...> wrote:
the "options"
> structure:
>
> global options
> options = read_options(parfile)
>
Snip
> Later on, I try and test some values in "options" via:
>
> if options.no_coda:
> # Eventually, here's where I'd remove the coda, but for
> # now, just...
> raise NotImplementedError, \
> "I can't deal with the no_coda option
yet."
>
I can see that you read your options of a parfile. If there are no
special formatting requirements for your parfile (i.e. fortran
namelist or similar), and it is read-only, I would suggest that you
make the parameter file into a python script (param.py) containing
your parameter assignments and import it directly to Peaks.py, and
other modules that need to access the parameters.
In python 2.0 I belive you can even import this as 'options' (I am on
thin ice here, you better check this)
import param as options
resulting in little code breakage. If the name of parfile is
changing (different parameters for different simulations) you can
import through the imp module.
EW
More information about the Python-list
mailing list