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 bethard, chris.jerdonek, paul.j3, r.david.murray, tati_alchueyr, tshepang
Date 2014-04-17.22:27:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1397773664.74.0.304164674103.issue17218@psf.upfronthosting.co.za>
In-reply-to
Content
The idea of nesting a mutually_exclusive_group in a titled argument_group is already present in `test_argparse.py`.

    class TestMutuallyExclusiveInGroup(MEMixin, TestCase):

    def get_parser(self, required=None):
        parser = ErrorRaisingArgumentParser(prog='PROG')
        titled_group = parser.add_argument_group(
            title='Titled group', description='Group description')
        mutex_group = \
            titled_group.add_mutually_exclusive_group(required=required)
        mutex_group.add_argument('--bar', help='bar help')
        mutex_group.add_argument('--baz', help='baz help')
        return parser

    failures = ['--bar X --baz Y', '--baz X --bar Y']
    successes = [
        ('--bar X', NS(bar='X', baz=None)),
        ('--baz Y', NS(bar=None, baz='Y')),
    ]
    successes_when_not_required = [
        ('', NS(bar=None, baz=None)),
    ]

    usage_when_not_required = '''\
        usage: PROG [-h] [--bar BAR | --baz BAZ]
        '''
    usage_when_required = '''\
        usage: PROG [-h] (--bar BAR | --baz BAZ)
        '''
    help = '''\

        optional arguments:
          -h, --help  show this help message and exit

        Titled group:
          Group description

          --bar BAR   bar help
          --baz BAZ   baz help
        '''
 
So now the question is - do we to modify `add_mutually_exclusive_group` to streamline this task?  An alternative is to add a note to the documentation, eg.

    Note that currently mutually exclusive argument groups do not     
    support the title and description arguments of add_argument_group().
    However a such a group can be added to a titled argument group.
    (and then add an example)
History
Date User Action Args
2014-04-17 22:27:44paul.j3setrecipients: + paul.j3, bethard, r.david.murray, chris.jerdonek, tshepang, tati_alchueyr
2014-04-17 22:27:44paul.j3setmessageid: <1397773664.74.0.304164674103.issue17218@psf.upfronthosting.co.za>
2014-04-17 22:27:44paul.j3linkissue17218 messages
2014-04-17 22:27:44paul.j3create