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 Endre, berker.peksag, bethard, paul.j3, xiang.zhang
Date 2016-05-08.20:22:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1462738965.89.0.59190949772.issue26952@psf.upfronthosting.co.za>
In-reply-to
Content
Argument Groups are not designed for nesting, and despite their names and subclassing, Mutually exclusive groups and Argument Groups are not meant to be used together (with one exception).

I agree that the error is obscure, but it occurs in a particularly fragile function in the formatter, '_format_actions_usage'.  That function needs a major rewrite (that's in another bug/issue).

Argument Groups serve only as a way of grouping help lines.  Mutually exclusive groups test arguments during parsing, and add some markings to the usage line.  So they have very different purposes.

I have seen questions on Stackoverflow where people try to use Argument Groups as a way of adding some sort of subgroup to the Mutually Exclusive one, one for example that implements a 'allow any of this group' logic.  There is a bug/issue asking for 'inclusive' nesting groups, but production patch of that sort is long ways off.  http://bugs.python.org/issue11588

This usage line

    (--url URL --project Prj [--dump]) | (--mergeInput input.txt [--removeDisabled])

suggests that this what you are trying do - allow any of -u,-p,-d, but disallow one of these with -m or -r.  That logic is beyond the current group testing mechanism, and beyond the usage formatting code.  You'll have to do your own tests, and write a custom usage line.

Mutually exclusive groups can be nested in other mutual groups, but the effect isn't what you might hope.  It just forms a larger mutually exclusive group; there's no subgrouping.

It is possible to nest a mutually exclusive group in an Argument group; the effect is to give the mutually exclusive group a title.
History
Date User Action Args
2016-05-08 20:22:45paul.j3setrecipients: + paul.j3, bethard, berker.peksag, xiang.zhang, Endre
2016-05-08 20:22:45paul.j3setmessageid: <1462738965.89.0.59190949772.issue26952@psf.upfronthosting.co.za>
2016-05-08 20:22:45paul.j3linkissue26952 messages
2016-05-08 20:22:45paul.j3create