New submission from andrew cooke <and...@acooke.org>:
The code below, when invoked with -h, prints: (.env) [andrew@localhost py]$ python -m tests_sa.argparse_bug -h usage: argparse_bug.py [-h] (-a A | [-b B | -c C)] options: -h, --help show this help message and exit -a A -b B -c C where the final two characters in the usage line are swapped. It should be usage: argparse_bug.py [-h] (-a A | [-b B | -c C]) or maybe even usage: argparse_bug.py [-h] (-a A | (-b B | -c C)) from argparse import ArgumentParser def main(): parser = ArgumentParser() outer = parser.add_mutually_exclusive_group(required=True) outer.add_argument('-a') inner = outer.add_mutually_exclusive_group() inner.add_argument('-b') inner.add_argument('-c') parser.parse_args() if __name__ == '__main__': main() ---------- components: Library (Lib) messages: 405509 nosy: acooke priority: normal severity: normal status: open title: Argparse exclusive group inside required exclusive group displays incorrectly versions: Python 3.10 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45690> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com