Why is the argparse module so inflexible?

Ethan Furman ethan at stoneleaf.us
Fri Jun 28 21:36:37 EDT 2013


On 06/27/2013 03:49 PM, Steven D'Aprano wrote:
>
> [rant]
> I think it is lousy design for a framework like argparse to raise a
> custom ArgumentError in one part of the code, only to catch it elsewhere
> and call sys.exit. At the very least, that ought to be a config option,
> and off by default.
>
> Libraries should not call sys.exit, or raise SystemExit. Whether to quit
> or not is not the library's decision to make, that decision belongs to
> the application layer. Yes, the application could always catch
> SystemExit, but it shouldn't have to.

So a library that is explicitly designed to make command-line scripts easier and friendlier should quit with a traceback?

Really?

--
~Ethan~



More information about the Python-list mailing list