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 Laszlo.Attila.Toth, iritkatriel, paul.j3
Date 2022-01-02.02:12:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1641089541.08.0.302269492527.issue46057@roundup.psfhosted.org>
In-reply-to
Content
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 :).
History
Date User Action Args
2022-01-02 02:12:21paul.j3setrecipients: + paul.j3, Laszlo.Attila.Toth, iritkatriel
2022-01-02 02:12:21paul.j3setmessageid: <1641089541.08.0.302269492527.issue46057@roundup.psfhosted.org>
2022-01-02 02:12:21paul.j3linkissue46057 messages
2022-01-02 02:12:20paul.j3create