[New-bugs-announce] [issue23795] argparse -- incorrect usage for mutually exclusive
João Ferreira
report at bugs.python.org
Fri Mar 27 19:02:33 CET 2015
New submission from João Ferreira:
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.
----------
components: Library (Lib)
messages: 239425
nosy: jotomicron
priority: normal
severity: normal
status: open
title: argparse -- incorrect usage for mutually exclusive
type: enhancement
versions: Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23795>
_______________________________________
More information about the New-bugs-announce
mailing list