command-line args

Michael mogmios at mlug.missouri.edu
Sat Apr 24 10:35:33 EDT 2004


> Create an empty module called "globals" and import that wherever
> needed.  Populate it with settings from the command-line parsing
> stage.  Get fancier and put defaults in there to begin with, and
> override them only if specified in the command-line parsing
> area.  Flavour as needed...

What do you do about multiple processes (of the same program) running at 
once? Save to /tmp/<pid>/globals.py or something like that?

> (That's just one option, but in many ways the simplest.  Some of
> us also use a simple "bag" type of object which we pass around
> as required, but that's more awkward with really large applications.)

I've done that before and yeh it is really a hassle with anything very 
large.




More information about the Python-list mailing list