-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Open
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dir
Description
Very similar to issue #110131 - the documentation is not clear on how default and count interact.
Consider
parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', action='count', default=3)
parser.parse_args(['-v'])
My intuition, and how I read the documentation, is that you should end up with verbose=1, but actually you get verbose=4.
I haven't checked the source code, but I assume under the hood something similar to append/extend is happening.
My take is that it would be better for default to really act as a default, and get overwritten rather than added to by the passed arguments. But if not, the documentation should be changed to something similar to what is written for action="append".
Metadata
Metadata
Assignees
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dir
Projects
Status
Doc issues
Status
Todo