Skip to content

argparse documentation: Improve optparse section regarding allow_interspersed_args #59463

Closed

Description

@nejucomo
mannequin
BPO 15258
Nosy @berkerpeksag

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2018-08-14.12:34:22.973>
created_at = <Date 2012-07-05.22:41:12.404>
labels = ['type-feature', 'docs']
title = 'argparse documentation: Improve optparse section regarding allow_interspersed_args'
updated_at = <Date 2018-08-14.12:34:22.971>
user = 'https://bugs.python.org/nejucomo'

bugs.python.org fields:

activity = <Date 2018-08-14.12:34:22.971>
actor = 'berker.peksag'
assignee = 'docs@python'
closed = True
closed_date = <Date 2018-08-14.12:34:22.973>
closer = 'berker.peksag'
components = ['Documentation']
creation = <Date 2012-07-05.22:41:12.404>
creator = 'nejucomo'
dependencies = []
files = []
hgrepos = []
issue_num = 15258
keywords = []
message_count = 3.0
messages = ['164702', '164755', '323511']
nosy_count = 5.0
nosy_names = ['nejucomo', 'amcnabb', 'v+python', 'docs@python', 'berker.peksag']
pr_nums = []
priority = 'normal'
resolution = 'out of date'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue15258'
versions = ['Python 2.7', 'Python 3.2', 'Python 3.3', 'Python 3.4']

Activity

  1. nejucomo commented on Jul 5, 2012

    nejucomomannequin
    MannequinAuthor

    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
      """
  2. added
    docs
    type-feature
    on Jul 5, 2012
  3. vpython commented on Jul 6, 2012

    vpythonmannequin
    Mannequin

    See also bpo-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.

  4. berkerpeksag commented on Aug 14, 2018

    @berkerpeksag
    Member

    ArgumentParser.parse_intermixed_arg() has been added in 0f6b9d2 (bpo-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'.

  5. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docstype-feature

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions