This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.j3
Recipients andrewnester, berker.peksag, bethard, brian.curtin, christofsteel, paul.j3
Date 2017-02-22.20:24:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Content "argparse improperly prints mutually exclusive options when they are in a group"

is similar.


There are two issues:

- the nesting of mutually exclusive groups

- the formatting of the usage in such cases.

Both have come up in one way or other in other bug reports.

Yes, it is possible to add a group to an existing group.  But from a testing standpoint the effect is the same as if you put all actions into one super group. 

More often people try to nest ArgumentGroups in MutuallyExclusiveGroups thinking that would give some sort of 'any' or 'and' logic within the 'xor' logic.  I have explored that in  

Defining nestable groups is relatively easy.  Writing good usage is much harder.
The usage formatter is brittle.  It creates a big string, strips out 'excess' characters (the problem here), and then splits and reassembles the string (leading to assertion errors if the metavars contain funny characters).


I submitted a patch that substantially rewrites the usage formatter.  The idea was to keep the action strings separate until the last moment.  While I haven't tested it with the current problem, I did use it in my nested-groups coding.

While I'm not opposed to patching the usage formatting in bits and pieces, we should do so while fully aware of the big picture.  Little patches tend to make brittle code even more brittle.
Date User Action Args
2017-02-22 20:24:41paul.j3setrecipients: + paul.j3, bethard, brian.curtin, berker.peksag, andrewnester, christofsteel
2017-02-22 20:24:41paul.j3setmessageid: <>
2017-02-22 20:24:41paul.j3linkissue29553 messages
2017-02-22 20:24:41paul.j3create