New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent validation of defaults in argparse
#100949
Comments
argparse
argparse
If the first behavior is indeed a bug, and the error should be raised when |
Defaults are put in the
This calls I don't think this is a problem. Some programmers might well want a |
I agree with the creator of the issue, it does not work like expected. why not introduce |
Bug report
The following does not trigger an exception in
ArgumentParser
, where I would expect an exception since the default value for--choice
is not in the list of choices:This is at least inconsistent behaviour, the following piece of code does trigger an exception for an invalid default value:
Environment: Python 3.10.9, Arch Linux, x86_64.
The text was updated successfully, but these errors were encountered: