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.

Title: argparse documentation: Improve optparse section regarding allow_interspersed_args
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.2, Python 3.3, Python 3.4, Python 2.7
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: docs@python Nosy List: amcnabb, berker.peksag, docs@python, nejucomo, v+python
Priority: normal Keywords:

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: )

* 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 (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

Closing this as 'outdated'.
Date User Action Args
2022-04-11 14:57:32adminsetgithub: 59463
2018-08-14 12:34:22berker.peksagsetstatus: open -> closed

nosy: + berker.peksag
messages: + msg323511

resolution: out of date
stage: resolved
2013-02-13 18:06:44amcnabbsetnosy: + amcnabb
2012-07-07 02:32:51terry.reedysetversions: - Python 3.1
2012-07-06 20:43:02v+pythonsetnosy: + v+python
messages: + msg164755
2012-07-05 22:41:12nejucomocreate