Passing options between modules

Michele Simionato michele.simionato at poste.it
Sat May 22 04:37:04 EDT 2004


David Goodger <goodger at python.org> wrote in message news:<mailman.147.1085160124.6949.python-list at python.org>...
> Chris wrote:
> > I'm trying to come up with a not-so-ugly manner of passing many
> > command-line options between modules.
> 
> Use optparse.py.  It's standard in Python 2.3, or get it from
> http://optik.sf.net for older versions of Python.
> 
> The result of parsing command-line options is a "Values" object,
> with standard dotted-attribute access.  For example, for
> "--an-option", you'd say "options.an_option".  It's easy to pass
> the single Values object around.
> 
> -- David Goodger

I second this. 
<shameless plug> 
You may also want to look at
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/278844
which will make your life with optparse easier.
</shameless plug>


    Michele Simionato



More information about the Python-list mailing list