Re: positional arguments left out it the cold

Greg Ward <[email protected]> Tue, 18 Feb 2003 21:33:38 -0500
Newsgroups gmane.comp.python.optik.user
Message-ID <[email protected]>
On 16 February 2003, John Belmonte said:
> After using OptionParser for a while, I'm starting to wonder about 
> something.  Why can't all of its features be applied to positional 
> arguments just as well as options?  I have the same need for type 
> checking, storage into a variable, callbacks, etc. with positional 
> arguments as I do with options.

Others have requested this in the past.  I can see the point, but it's
not something I've ever needed badly.  If you can think up a good way to
do it, go ahead and code up a patch.  The right design is not
immediately apparent to me, so feel free to discuss design ideas here
first.  (I reserve the right to summarily reject patches with the wrong
design!)

> Why not rename the class to ArgumentParser and extend it to support 
> positional args as it does options?

That doesn't feel quite right to me.  My gut instinct is leaning towards
a two-pass solution, ie. parse options and then parse positional args.

        Greg
-- 
Greg Ward <[email protected]>                         http://www.gerg.ca/
Any priest or shaman must be presumed guilty until proven innocent.


-------------------------------------------------------
This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
The most comprehensive and flexible code editor you can use.
Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial.
www.slickedit.com/sourceforge