[Python-Dev] ConfigParser shootout, preliminary entry

Barry Warsaw barry at python.org
Fri Oct 22 00:33:15 CEST 2004

On Thu, 2004-10-21 at 16:47, Johannes Gijsbers wrote:

> I'm surprised no one has mentioned optparse yet. It already has all the
> features you use in this example. Maybe a similar API for configuration file
> parsing would be nice, if only for the sake of consistency:
>   parser = ConfigParser()
>   parser.add_option("network-parameters", "poll-time", type="float", 
>                     dest="poll_time")
>   parser.add_option("network-parameters", "use-ssl", type="bool", 
>                     dest="use_ssl")
>   parser.add_option("ui-parameters", "window-title", type="float", 
>                     dest="window_title")
>   options = parser.parse_file('foo.conf')
>   print options.window_title
>   print options.use_ssl
>   # etc.
> Bonus points if the implementation allows me to specify a command-line option
> and configuration file option with one call, as in docutils [1]. More bonus
> points for reusing optparse code.

This is a very intriguing idea.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/python-dev/attachments/20041021/8584e8e3/attachment.pgp

More information about the Python-Dev mailing list