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".
Linked PRs
Very similar to issue #110131 - the documentation is not clear on how default and count interact.
Consider
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".
Linked PRs