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
In the "Arguments Containing -" section of the argparse documentation it says:
positional arguments may only begin with - if they look like negative numbers and there are no options in the parser that look like negative numbers
However, negative numbers with exponent notation are rejected. I feel this is a bug.
With file apbug.py containing
apbug.py
#!/usr/bin/env python3.10 import argparse ap = argparse.ArgumentParser() ap.add_argument("maybe_neg", default=False) print("try -3.0"); args = ap.parse_args(args=["-3.0",]) print("try -3.0e0"); args = ap.parse_args(args=["-3.0e0",])
execution results in
$ ./apbug.py try -3.0 try -3.0e0 usage: apbug.py [-h] maybe_neg apbug.py: error: the following arguments are required: maybe_neg
The text was updated successfully, but these errors were encountered:
No branches or pull requests
mwette commentedSep 21, 2022
•
edited
Bug report
In the "Arguments Containing -" section of the argparse documentation it says:
However, negative numbers with exponent notation are rejected. I feel this is a bug.
With file
apbug.pycontainingexecution results in
Your environment
The text was updated successfully, but these errors were encountered: