[issue15258] argparse documentation: Improve optparse section regarding allow_interspersed_args
New submission from Nefarious CodeMonkey, Jr. <nejucomo@users.sourceforge.net>: 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 """ ---------- assignee: docs@python components: Documentation messages: 164702 nosy: docs@python, nejucomo priority: normal severity: normal status: open title: argparse documentation: Improve optparse section regarding allow_interspersed_args type: enhancement versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue15258> _______________________________________
Glenn Linderman <v+python@g.nevcal.com> added the comment: 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. ---------- nosy: +v+python _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue15258> _______________________________________
Changes by Terry J. Reedy <tjreedy@udel.edu>: ---------- versions: -Python 3.1 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue15258> _______________________________________
Changes by Andrew McNabb <amcnabb@mcnabbs.org>: ---------- nosy: +amcnabb _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue15258> _______________________________________
Berker Peksag <berker.peksag@gmail.com> added the comment: ArgumentParser.parse_intermixed_arg() has been added in https://github.com/python/cpython/commit/0f6b9d230674da784ca79a0cf1a03d2af5a... (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'. ---------- nosy: +berker.peksag resolution: -> out of date stage: -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue15258> _______________________________________
participants (5)
-
Andrew McNabb
-
Berker Peksag
-
Glenn Linderman
-
Nefarious CodeMonkey, Jr.
-
Terry J. Reedy