GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — add "Name Collision" section to argparse docs · Issue #59633 · python/cpython

add "Name Collision" section to argparse docs #59633

New issue
Copy link
New issue
Copy link
Closed
#150987
Closed
add "Name Collision" section to argparse docs#59633
#150987
Copy link
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dirtype-featureA feature request or enhancementA feature request or enhancement

Description

bethard
mannequin
opened on Jul 23, 2012
Issue body actions
BPO 15428

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 = None
created_at = <Date 2012-07-23.00:00:31.958>
labels = ['type-feature', 'docs']
title = 'add "Name Collision" section to argparse docs'
updated_at = <Date 2014-08-07.23:27:58.493>
user = 'https://bugs.python.org/bethard'

bugs.python.org fields:

activity = <Date 2014-08-07.23:27:58.493>
actor = 'paul.j3'
assignee = 'docs@python'
closed = False
closed_date = None
closer = None
components = ['Documentation']
creation = <Date 2012-07-23.00:00:31.958>
creator = 'bethard'
dependencies = []
files = []
hgrepos = []
issue_num = 15428
keywords = []
message_count = 2.0
messages = ['166185', '225046']
nosy_count = 3.0
nosy_names = ['bethard', 'docs@python', 'paul.j3']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue15428'
versions = ['Python 2.7', 'Python 3.4', 'Python 3.5']

Linked PRs

  • GH-59633: Clarify dest collisions in argparse docs #150987
  • [3.15] GH-59633: Clarify dest collisions in argparse docs (GH-150987) #151188
  • [3.14] GH-59633: Clarify dest collisions in argparse docs (GH-150987) #151194
  • [3.13] GH-59633: Clarify dest collisions in argparse docs (GH-150987) #151196

Activity

  1. bethard commented on Jul 23, 2012

    @bethard
    bethardmannequin
    on Jul 23, 2012
    MannequinAuthor
    More actions

    Several bugs (e.g. bpo-15327 and bpo-15271) have been filed suggesting that people aren't really clear on how argparse handles argument name collisions or how they can get it to do what they want.

    I think these problems could probably be solved by a "Name Collision" section (or something like that) in the argparse documentation. It would give a few example problems and show how to resolve them. Some things to include:

    • What happens when two arguments have the same dest (bpo-15271), with solutions including action='append' or different dest= values combined with identical metavar= values.

    • What happens when a parser and a sub-parser share some of the same argument names (bpo-15327), with solutions including specifying different dest= values for the parser and sub-parser

    • A brief mention and cross-reference to the "conflict_handler" section.

  2. bethard
    assigned
    docspython
    on Jul 23, 2012
  3. bethard
    added
    docsDocumentation in the Doc dirDocumentation in the Doc dir
    on Jul 23, 2012
  4. BreamoreBoy
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Aug 3, 2014
  5. paulj3 commented on Aug 7, 2014

    @paulj3
    paulj3mannequin
    on Aug 7, 2014
    Mannequin
    More actions

    On Stackoverflow a couple of posters have asked about nesting namespaces as a way of separating the parser and subparser arguments.

    http://stackoverflow.com/questions/15782948
    http://stackoverflow.com/questions/18668227

    One solution that I rather like http://stackoverflow.com/a/18709860/901925

    uses a custom Namespace class that recognizes a 'dest' like

        p.add_argument('--deep', dest='test.doo.deep')

    and produces

        Nestedspace(foo='test', test=Nestedspace(bar='baz', doo=Nestedspace(deep='doodod')))

    I wonder if a simplified version of this could be added to the Namespace section in the documentation.

    There are 2 sides to the name conflict issue:

    • what control does the programmer have over names (esp. when using [parents] and subparsers)?

    • how does the programmer want to access the arguments in the resulting namespace?

  6. ezio-melotti
    transferred this issue fromon Apr 10, 2022
  7. erlend-aasland
    added this to Argparse issueson May 19, 2022
  8. erlend-aasland
    moved this to Doc issues in Argparse issueson May 19, 2022
  9. savannahostrowski
    linked a pull request that will close this issueGH-59633: Clarify dest collisions in argparse docs #150987on Jun 5, 2026
  10. savannahostrowski
    added a commit that references this issue on Jun 9, 2026

    GH-59633: Clarify dest collisions in argparse docs (#150987)

    82cb7d4
  11. savannahostrowski
    closed this as completedin #150987on Jun 9, 2026
  12. savannahostrowski
    added 3 commits that reference this issue on Jun 9, 2026

    [3.15] GH-59633: Clarify dest collisions in argparse docs (GH-150987) (…

    ba8d0e3

    [3.14] GH-59633: Clarify dest collisions in argparse docs (GH-150987) (…

    4ab21ec

    [3.13] GH-59633: Clarify dest collisions in argparse docs (GH-150987) (…

    848b982
  13. clin1234
    added a commit that references this issue on Jun 9, 2026

    pythonGH-59633: Clarify dest collisions in argparse docs (python#150987)

    aa1a8c5
  14. philthompson10
    added a commit that references this issue on Jun 17, 2026

    pythonGH-59633: Clarify dest collisions in argparse docs (python#150987)

    28df50d
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

    docsDocumentation in the Doc dirDocumentation in the Doc dirtype-featureA feature request or enhancementA feature request or enhancement

    Projects

    • Argparse issues
      Status
      Doc issues
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402520 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.