paul j3 <ajipa...@gmail.com> added the comment:

With one exception, groups are not designed or intended to be nested.  But by 
inheritance (from _ActionsContainer) nesting isn't blocked nor does it raise 
any errors.

As you surmise, an ArgumentGroup, is used only for grouping the help lines.  By 
default that are two groups, with 'optionals' and 'required' names (actually 
the later should be 'positional').  The rest are user defined.  They don't 
affect parsing in any way.

MutuallyExclusiveGroup is used in parsing.  It also is used, to the extent 
possible, when formatting usage.

If a MutuallyExclusiveGroup is nested inside another MutuallyExclusiveGroup the 
parsing effect is just one flat group.  Usage can be messed up - that's been 
the subject of another bug/issue.

A MutuallyExclusiveGroup may be put in an ArgumentGroup.  This is a way of 
giving the exclusive group a title and/or description in the help.

There is a bug/issue requesting some sort of inclusive group.  I tried to 
develop such a patch, implementing nesting, complete logic control (not just 
the current xor).  But the usage formatting needs a complete rewrite.  Overall 
this is too complex of an addition.  On StackOverFlow I tell people to 
implement their own post-parsing testing.

----------
nosy: +paul.j3

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38590>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to