Message239425
The usage that is printed by argparse with the "--help" argument is slightly incorrect when using mutually exclusive groups. This happens in version 3.4.3 but did not happen in version 3.4.0.
I have this minimal example:
import argparse
p = argparse.ArgumentParser()
g1 = p.add_mutually_exclusive_group(required=False)
g1.add_argument("-a")
g1.add_argument("-b")
g2 = p.add_mutually_exclusive_group(required=False)
g2.add_argument("-c")
g2.add_argument("-d")
p.parse_args()
In python 3.4.0, "python test.py --help" produces the usage:
usage: test.py [-h] [-a A | -b B] [-c C | -d D]
In python 3.4.3, the usage is:
usage: test.py [-h] [-a A | -b B [-c C | -d D]
Note the absence of the closing square bracket after B. |
|
Date |
User |
Action |
Args |
2015-03-27 18:02:33 | jotomicron | set | recipients:
+ jotomicron |
2015-03-27 18:02:33 | jotomicron | set | messageid: <1427479353.63.0.760069319945.issue23795@psf.upfronthosting.co.za> |
2015-03-27 18:02:33 | jotomicron | link | issue23795 messages |
2015-03-27 18:02:33 | jotomicron | create | |
|