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


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

Re: Why is the argparse module so inflexible?

Started byTim Chase <python.list@tim.thechases.com>
First post2013-06-27 19:22 -0500
Last post2013-06-27 19:22 -0500
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? Tim Chase <python.list@tim.thechases.com> - 2013-06-27 19:22 -0500

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

FromTim Chase <python.list@tim.thechases.com>
Date2013-06-27 19:22 -0500
SubjectRe: Why is the argparse module so inflexible?
Message-ID<mailman.3946.1372378844.3114.python-list@python.org>
On 2013-06-28 09:02, Cameron Simpson wrote:
> 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.
> 
> I invoke command line scripts interactively. There's no special
> case here.
> 
> 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.

I too have several small utilities that use a combination of cmd.Cmd,
shlex.shlex(), and command-processing libraries.  However, much like
Cameron's code using getopt, my older code is still using optparse
which gives me the ability to override the error() method's default
sys.exit() behavior and instead raise the exception of your choice.

-tkc


[toc] | [standalone]


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


csiph-web