Passing options between modules

David Goodger goodger at python.org
Fri May 21 13:21:56 EDT 2004


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





More information about the Python-list mailing list