Message266602
Small example:
import argparse
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--no-foo', dest='foo', action='store_false', help="Suppress foo")
args = parser.parse_args()
print('foo = {}'.format(args.foo))
Output with "-h":
optional arguments:
-h, --help show this help message and exit
--no-foo Suppress foo (default: True)
A reasonable person reading that would think that we suppress foo by default. But actually, foo is True by default - "--no-foo" is off by default. I would suggest that if action='store_false', the default value reported by the formatter should be flipped. |
|
Date |
User |
Action |
Args |
2016-05-29 16:39:34 | Colin Morris | set | recipients:
+ Colin Morris |
2016-05-29 16:39:34 | Colin Morris | set | messageid: <1464539974.48.0.860363682331.issue27153@psf.upfronthosting.co.za> |
2016-05-29 16:39:34 | Colin Morris | link | issue27153 messages |
2016-05-29 16:39:34 | Colin Morris | create | |
|