>>> import argparse
>>> parser = argparse.ArgumentParser(prog='baz', argument_default=argparse.SUPPRESS)
>>> parser.add_argument('-s', '--spam', action='store_true')
_StoreTrueAction(option_strings=['-s', '--spam'], dest='spam', nargs=0, const=True, default='==SUPPRESS==', type=None, choices=None, required=False, help=None, metavar=None, deprecated=False)
>>> parser.parse_args()
Namespace()
>>> parser.parse_args(['-s'])
Namespace(spam=True)
Documentation
While the docs seem to imply that
FalseandTrueare always the defaults for the store_true and store_false actions respectively, that is only true ifargument_defaultis not passed. This should be more clearly documented.Linked PRs