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 <[email protected]>
<http://bugs.python.org/issue23795>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com