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

Don't add an argument_group to another argument_group.  While input allows this 
nesting, the formatting is not designed to handle it.  Nor does the 
documentation illustrate such nesting.

Nesting a mutually_exclusive_group in an argument_group works because the 
exclusive_group is not used in formatting the help lines.  The two class of 
groups have very different purposes.

Note that the add_argument_group() method is defined for the parent 
_ActionsContainer class.  ArgumentParser inherits from this, as do both of the 
group classes.  While one could make a case for changing the group's 
inheritance of this method to Not-implemented, it's only a problem when users, 
like you, try to push for undocumented usage.

In general argparse has a clean and powerful class structure.  But it doesn't 
do a lot of checking and pruning, so there loose ends like this.  The Action 
class and its subclasses is similarly powerful, with enough loose ends to allow 
adventurous users to hang themselves :).

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

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

Reply via email to