[issue34742] Add optional argument for exit status in argparse.ArgumentParser.error

2018-09-20 Thread paul j3
paul j3 added the comment: While I don't think this change will cause any backward compatibility issues, I wonder whether it does much good. https://docs.python.org/3/library/argparse.html#exiting-methods already documents the option of customizing `parser.exit` and `parser.error`

[issue34742] Add optional argument for exit status in argparse.ArgumentParser.error

2018-09-20 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Seems like a reasonable addition (Customization of writing to sys.stderr too) . It seems to have been inherited from optparse which has pretty much the same code with hardcoded exit code. The solution suggested is to catch SystemExit and provide

[issue34742] Add optional argument for exit status in argparse.ArgumentParser.error

2018-09-20 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34742] Add optional argument for exit status in argparse.ArgumentParser.error

2018-09-19 Thread paul j3
Change by paul j3 : -- nosy: +paul.j3 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34742] Add optional argument for exit status in argparse.ArgumentParser.error

2018-09-19 Thread Ankit Goel
New submission from Ankit Goel : argparse.ArgumentParser.error currently uses a hard coded exit status (2). An optional argument (with default value 2) would be useful to change the status without needing to overwrite the method in a subclass like here: