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 balage, paul.j3
Date 2015-12-17.18:17:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1450376244.05.0.33169945397.issue25882@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015-12-17 18:17:24paul.j3setrecipients: + paul.j3, balage
2015-12-17 18:17:24paul.j3setmessageid: <1450376244.05.0.33169945397.issue25882@psf.upfronthosting.co.za>
2015-12-17 18:17:24paul.j3linkissue25882 messages
2015-12-17 18:17:23paul.j3create