You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
argparse docs: Positional * argument in mutually exclusive group requires a default parameter #70423
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2016-01-29.00:16:38.018>labels= ['docs']
title='argparse docs: Positional * argument in mutually exclusive group requires a default parameter'updated_at=<Date2016-01-30.02:42:42.063>user='https://bugs.python.org/paulj3'
needs a note that a mutually exclusive group may contain one positional argument. But that argument must be either nargs='?', or nargs='*'. If '*' it must also have a default parameter (other than None).
(this issue came up recently on stackoverflow. It may have also been raised in the past as a bug/issue, but I don't have time at moment to search. I had to search through several layers of code to remember all the details.)
Activity
paulj3 commentedon Jan 29, 2016
The documentation for Mutual exclusion
https://docs.python.org/3/library/argparse.html#mutual-exclusion
needs a note that a mutually exclusive group may contain one positional argument. But that argument must be either nargs='?', or nargs='*'. If '*' it must also have a default parameter (other than None).
(this issue came up recently on stackoverflow. It may have also been raised in the past as a bug/issue, but I don't have time at moment to search. I had to search through several layers of code to remember all the details.)
http://stackoverflow.com/questions/35044288/how-can-i-create-an-argparse-mutually-exclusive-group-with-multiple-positional-p
serhiy-storchaka commentedon Sep 26, 2024
It was changed in #124306.