optparse - required options

Robert Dailey rcdailey at gmail.com
Fri Aug 24 13:35:20 EDT 2007


Thank you VERY much for mentioning argparse- this is EXACTLY what I needed!
Thank you!

On 8/23/07, Steven Bethard <steven.bethard at gmail.com> wrote:
>
> Omari Norman wrote:
> > On Mon, Aug 20, 2007 at 05:31:00PM -0400, Jay Loden wrote:
> >> Robert Dailey wrote:
> >>> Well, I don't know what is wrong with people then. I don't see how
> >>> required arguments are of bad design.
> >
> >> I tend to agree...while "required option" may be an oxymoron in
> >> English, I can think of quite a few scripts I've written myself (in
> >> various languages) that needed at least some kind of user input to
> >> operate.
> >
> > The idea with optparse is not that programs should not require certain
> > information on the command line; rather, the idea is that this
> > information should be positional arguments, not 'options'.
> >
> > That is, to use the compiler example:
> >
> > compiler file
> >
> > is preferred if a file argument is necessary.
> >
> > compiler --file file
> >
> > is not preferred.
>
> I agree with the optparse philosophy, but Practicality Beats Purity.
> That's why I was convinced to add "required options" to argparse --
> there are too many applications that want that kind of interface.
> *I* don't write applications with interfaces like that, but enough
> people do that the use case should really be supported.
>
> STeVe
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070824/6974aa00/attachment.html>


More information about the Python-list mailing list