Issue 28220: argparse's add_mutually_exclusive_group() should accept title and description (original) (raw)

Issue28220

Created on 2016-09-20 20:59 by barry, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (4)
msg277067 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2016-09-20 20:59
I'd love to sneak this into 3.6, but I can accept being too late. In any case, _MutuallyExclusiveGroup.__init__() should accept title and description arguments and pass them to the super class. Otherwise, you can't great a mutually exclusive group that also essentially acts as an argument group.
msg277069 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2016-09-20 21:04
Hmm, it might be more complicated than that, so let's ignore 3.6
msg277071 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2016-09-20 21:09
The workaround is to do something like: group = parser.add_argument_group(title, description) me_group = group.add_mutually_exclusive_group() me_group.add_argument(...blah blah blah...)
msg277079 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-09-20 23:00
Unless I'm missing something, this is a duplicate of issue 17218 :)
History
Date User Action Args
2022-04-11 14:58:37 admin set github: 72407
2016-09-20 23:00:15 berker.peksag set status: open -> closedsuperseder: support title and description in argparse add_mutually_exclusive_groupnosy: + berker.peksagmessages: + resolution: duplicatestage: resolved
2016-09-20 21:09:09 barry set messages: +
2016-09-20 21:04:25 barry set messages: + versions: - Python 3.6
2016-09-20 20:59:58 barry create