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 dongwm
Recipients bethard, dongwm
Date 2015-01-22.05:41:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1421905312.49.0.407798450784.issue23298@psf.upfronthosting.co.za>
In-reply-to
Content
Sometimes I need to use argparse like this:


>>> parser = argparse.ArgumentParser(prog='PROG')
>>> group = parser.add_mutually_dependence_group()
>>> group.add_argument('--foo')
>>> group.add_argument('--bar')
>>> parser.parse_args(['--foo', 'f', '--bar', 'b'])
Namespace(bar='b', foo='f')
>>> parser.parse_args(['--foo', 'f'])
PROG: error: --foo dependence on --bar
>>> parser.parse_args(['--bar', 'b'])
PROG: error: --bar dependence on --foo

I have some optional argument. but if any argument in a group was present on the command line. i need the others must also was present on. so i think ``add_mutually_dependence_group`` does make sense.
History
Date User Action Args
2015-01-22 05:41:53dongwmsetrecipients: + dongwm, bethard
2015-01-22 05:41:52dongwmsetmessageid: <1421905312.49.0.407798450784.issue23298@psf.upfronthosting.co.za>
2015-01-22 05:41:52dongwmlinkissue23298 messages
2015-01-22 05:41:52dongwmcreate