Why is the argparse module so inflexible?

Cameron Simpson cs at zip.com.au
Thu Jun 27 19:34:48 EDT 2013


On 27Jun2013 22:49, Steven D'Aprano <steve+comp.lang.python at pearwood.info> 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.

+1
-- 
Cameron Simpson <cs at zip.com.au>

There is more stupidity than hydrogen in the universe, and it has a
longer shelf life.      - Frank Zappa



More information about the Python-list mailing list