Issue 15258: argparse documentation: Improve optparse section regarding allow_interspersed_args (original) (raw)

Issue15258

Created on 2012-07-05 22:41 by nejucomo, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg164702 - (view) Author: Nefarious CodeMonkey, Jr. (nejucomo) Date: 2012-07-05 22:41
It was not obvious from the documentation on argparse how to emulate the optparse.OptionParser.allow_interspersed_args feature. Please add something like the following to the section titled "Upgrading optparse code" (see: http://docs.python.org/library/argparse.html#upgrading-optparse-code ) """ * If the optparse code sets allow_interspersed_args to False, then add an argparse positional argument with nargs=argparse.REMAINDER """
msg164755 - (view) Author: Glenn Linderman (v+python) * Date: 2012-07-06 20:43
See also issue 14191, which describes the problems of trying to make argparse achieve the goal of the default optparse handling of allow_interspersed_args ! The documentation for that branch of the feature is also seriously incomplete, and the workaround is more than a single line.
msg323511 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2018-08-14 12:34
ArgumentParser.parse_intermixed_arg() has been added in https://github.com/python/cpython/commit/0f6b9d230674da784ca79a0cf1a03d2af5a8b6a8 (Issue 14191) and the "Upgrading optparse code" section now has the following item: * Replace optparse.OptionParser.disable_interspersed_args() by using ArgumentParser.parse_intermixed_args() instead of ArgumentParser.parse_args(). Closing this as 'outdated'.
History
Date User Action Args
2022-04-11 14:57:32 admin set github: 59463
2018-08-14 12:34:22 berker.peksag set status: open -> closednosy: + berker.peksagmessages: + resolution: out of datestage: resolved
2013-02-13 18:06:44 amcnabb set nosy: + amcnabb
2012-07-07 02:32:51 terry.reedy set versions: - Python 3.1
2012-07-06 20:43:02 v+python set nosy: + v+pythonmessages: +
2012-07-05 22:41:12 nejucomo create