[Python-Dev] PEP 389: argparse - new command line parsing module

Yuvgoog Greenle ubershmekel at gmail.com
Sat Oct 3 19:46:19 CEST 2009


On Sat, Oct 3, 2009 at 8:29 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> I could show a thousand other examples. It simply isn't true that all,
> or even most, modules have their own exception types.

I might be wrong on this. Your point is extra true for modules in the
standard library (which is what we're talking about for argparse).

I just think that if a parser error is causing the SystemExit, I would
rather catch a parser error than catching a SystemExit for the sake of
readability. It saves me the comments:

# Catching SystemExit because parse_args() throws SystemExit on parser errors.

# Subclassing ArgumentParser and overriding exit because I don't want
to exit() upon parser errors.

So I'm sorry if what I said was irrelevant. I've never written or
taken part of writing a std-lib module.

--yuv


More information about the Python-Dev mailing list