paul j3 added the comment:

Argument groups are not designed to be nested.

If you print_help the parent parser, you'll see that the sub_args are missing 
entirely, not just displaced.  They appear in the usage, but not the help 
lines.  sub_group has no record that it was added to global_group (it doesn't 
have the ._container attribute).  

All containers, both parsers and groups, have a ._action_groups list (inherited 
from their common super), but I don't think any of the group code uses that 
list.  And the part of the help_formatter than handles groups is not recursive. 
 It handles just one level of groups.

I suspect the sub_group actions appear in the 'optional arguments' group for 
similar reasons as with the mutually_exclusive_group, but the details probably 
differ.

There have been a number of questions on SO about using argument_groups to add 
actions to a mutually_exclusive_group.  They either want a convenient way of 
adding a group of actions, or they want some sort of 'any'  logic applied to 
the subgroup.  We've had to say - no you can't nest groups like that.  I have 
explored in another bug/issue the idea of nesting groups and applying all sorts 
of logic (not just xor), but that's a big issue.

----------

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

Reply via email to