This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Pythass
Recipients Pythass, eric.smith, paul.j3, rhettinger, xtreak
Date 2022-03-13.18:06:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1647194790.23.0.461213701744.issue47002@roundup.psfhosted.org>
In-reply-to
Content
The curious aspect is that for:

import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-u", "--utc", choices=["-1"])
args = parser.parse_args()

it works. But if we use the colon (:) character as:
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-u", "--utc", choices=["-1:"])
args = parser.parse_args()

it does not work anymore... I could think maybe the issue could be related to the presence of ":" character together with "-" character.

For example for:
choices=["-:"] does not work
choices=["-"] works
choices=[":"] works
choices=[":-"] works

So, we get the error if the option start with "-" and has inside also ":" character. At this point I don't think it is related strictly to "negative numbers".
History
Date User Action Args
2022-03-13 18:06:30Pythasssetrecipients: + Pythass, rhettinger, eric.smith, paul.j3, xtreak
2022-03-13 18:06:30Pythasssetmessageid: <1647194790.23.0.461213701744.issue47002@roundup.psfhosted.org>
2022-03-13 18:06:30Pythasslinkissue47002 messages
2022-03-13 18:06:30Pythasscreate