[issue29553] Argparser does not display closing parentheses in nested mutex groups
New submission from Christoph Stahl: When creating nested mutually exclusive groups, all closing brackets except one are omitted. Example: parser = ArgumentParser() group = parser.add_mutually_exclusive_group() group.add_argument('-a') group.add_argument('-b') group2 = group.add_mutually_exclusive_group() group2.add_argument('-c') group2.add_argument('-d') group3 = group2.add_mutually_exclusive_group() group3.add_argument('-e') group3.add_argument('-f') prints a usage line of: usage: test.py [-h] [-a A | -b B | [-c C | -d D | [-e E | -f F] it should print something like: usage: test.py [-h] [-a A | -b B | [-c C | -d D | [-e E | -f F]]] -- components: Library (Lib) messages: 287776 nosy: christofsteel priority: normal severity: normal status: open title: Argparser does not display closing parentheses in nested mutex groups versions: Python 2.7, Python 3.6 ___ Python tracker <http://bugs.python.org/issue29553> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29553] Argparser does not display closing parentheses in nested mutex groups
Changes by Christoph Stahl : -- type: -> behavior ___ Python tracker <http://bugs.python.org/issue29553> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29553] Argparser does not display closing parentheses in nested mutex groups
Christoph Stahl added the comment: Hi, I thought a bit about the problem and came up with the following: The | in the usage is de facto an XOR operator. Exactly one of the options can be used. The XOR operator has the associative property, meaning: (A XOR B) XOR C = A XOR (B XOR C) So translated to the | this means: [[ -a | -b ] | -c ] = [ -a | [ -b | -c ]] usually one writes: [ -a | -b | -c ] So I propose dropping the inner brackets altogether. -- ___ Python tracker <http://bugs.python.org/issue29553> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com