Re: FileOptionParser and DefaultOption

Dirk Groeneveld <[email protected]> Tue, 30 Aug 2005 19:31:07 -0700 (PDT)
Newsgroups gmane.comp.python.optik.user
Message-ID <[email protected]>
I apologize for the late response, I travelled Europe immediately after I 
sent the last mail and didn't get a chance to work on anything. It was 
nice though ;-)

On Thu, 28 Jul 2005, Greg Ward wrote:
> [Dirk Groeneveld]
>> As part of a bigger project I wrote an OptionParser class that reads
>> option defaults from a configuration file (in the ConfigFile way). The
>> configuration file itself is another command line option. Normal defaults
>> are still supported as before, so the order of precedence becomes
>> defaults, configuration file (if given), command line options, from low to
>> high.
>
> It's funny, I've never felt a burning need to unify Optik with config
> file parsing.  I *have* felt a powerful need for a better config file
> library in Python, it's just that I've never been tempted to hijack
> Optik for that purpose.  Not sure what my reservation is, since a lot of
> the work that Optik does is relevant to config files.  Must be some
> atavistic "do one thing and do it well" urge.

I'm completely with you on "do one thing and do it well", and if the 
FileOptionParser doesn't fit in there, then so be it. On the other side of 
the spectrum is "batteries included", and I'm hoping this could be a 
battery worth having. Whether Optik is the right place to put it or not, I 
don't know, but I haven't found a better spot for it.

>> My question is if you would consider including this class into the
>> mainstream optik distribution. In that case I'd create some more
>> documentation and make a patch ... and replace tabs with spaces ;-)
>
> Well, since that's my job rather than Dan's, perhaps you should post the
> source to optik-users.  Or file a patch against Optik on SourceForge.
> But keep the above paragraph in mind!

I put the patch into sourceforge, the ID is 1277048 and my sourceforge 
nick is marvinalone.

>> You may be interested in reading some discussion on your "marriage" between
>> command line option parsing and configuration file parsing on the
>> configuration shootout page:
>> http://wiki.python.org/moin/ConfigParserShootout.
>
> Wow, I had no idea there had been so much interest in this.  I'd better
> go write my own config parsing library, quick!  ;->

I don't want to enter any holy wars over this. I'm coming from a "this 
works for me, maybe it'll work for others" point of view, even though I'm 
anxious to see what the result of the shootout will be.

Dirk


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf