[Python-3000] Combined configparse + optparse (interest?)

Neal Becker ndbecker2 at gmail.com
Tue Dec 11 02:09:13 CET 2007


Neal Becker wrote:

> Right now we have 2 rather different stdlib modules for parsing options
> from
> ini-style files and from command line.  I believe it would be desirable to
> have one module that can handle both.  Is there interest in pursuing this
> idea?

Can python learn from c++?  Maybe sometimes.  I think the design of
boost::program_options is a pretty example. 

http://www.boost.org/regression-logs/cs-win32_metacomm/doc/html/program_options.html

The basic design is split into 3 components:
 * Options Description
 * Parsers
 * Storage 

One of the benefits of this separation is that various parsers can be
plugged in.  The library includes 3 parsers:
 * Command line
 * ini-file
 * environment variables

IMO, this design would be a good starting point for a python library.



More information about the Python-3000 mailing list