Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #49350 > unrolled thread

Re: Why is the argparse module so inflexible?

Started byCameron Simpson <cs@zip.com.au>
First post2013-06-28 09:02 +1000
Last post2013-06-28 09:02 +1000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Why is the argparse module so inflexible? Cameron Simpson <cs@zip.com.au> - 2013-06-28 09:02 +1000

#49350 — Re: Why is the argparse module so inflexible?

FromCameron Simpson <cs@zip.com.au>
Date2013-06-28 09:02 +1000
SubjectRe: Why is the argparse module so inflexible?
Message-ID<mailman.3943.1372375979.3114.python-list@python.org>
On 27Jun2013 11:50, Ethan Furman <ethan@stoneleaf.us> wrote:
| If the OP is writing an interactive shell, shouldn't `cmd` be used
| instead of `argparse`?  argparse is, after all, intended for
| argument parsing of command line scripts, not for interactive work.

This is specious.

I invoke command line scripts interactively. There's no special case here.

If argparse is raising a useful and inspectable bad argument
exception, why not let it out? Catching that argument and wrapping
it in something opaque seems unhelpful.  After all, if the caller
really wanted to abort on bad arguments the caller would simply not
catch that exception.  There's no need to transmute it into a
whole-program abort.

If Terry's assertion is that the OP has told argparse he never wants
to see bad input, how does one turn that off?

To add to the use case stats, I also subclass cmd and parse interactive
command lines. I'm beginning to be pleased I'm still using Getopt
for that instead of feeling I'm lagging behind the times.

Cheers,
-- 
Cameron Simpson <cs@zip.com.au>

If it can't be turned off, it's not a feature. - Karl Heuer

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web