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 andersk
Recipients andersk, bethard, drm, eric.araujo, eric.smith, gdb, nelhage, r.david.murray
Date 2011-02-06.19:12:18
SpamBayes Score 0.0048026484
Marked as misclassified No
Message-id <1297019538.75.0.803498628689.issue9334@psf.upfronthosting.co.za>
In-reply-to
Content
There are some problems that ‘=’ can’t solve, such as options with nargs ≥ 2.  optparse has no trouble with this:

>>> parser = optparse.OptionParser()
>>> parser.add_option('-a', nargs=2)
>>> parser.parse_args(['-a', '-first', '-second'])
(<Values at 0x7fc97a93a7e8: {'a': ('-first', '-second')}>, [])

But inputting those arguments is _not possible_ with argparse.

>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('-a', nargs=2)
>>> parser.parse_args(['-a', '-first', '-second'])
usage: [-h] [-a A A]
: error: argument -a: expected 2 argument(s)
History
Date User Action Args
2011-02-06 19:12:18andersksetrecipients: + andersk, bethard, eric.smith, eric.araujo, r.david.murray, gdb, nelhage, drm
2011-02-06 19:12:18andersksetmessageid: <1297019538.75.0.803498628689.issue9334@psf.upfronthosting.co.za>
2011-02-06 19:12:18andersklinkissue9334 messages
2011-02-06 19:12:18anderskcreate