Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Minor documentation fix: incorrect statement about argparse.ArgumentParser.add_argument()#145479

Merged
savannahostrowski merged 4 commits intopython:mainfrom
jkunimune:patch-3
Mar 3, 2026
Merged

Minor documentation fix: incorrect statement about argparse.ArgumentParser.add_argument()#145479
savannahostrowski merged 4 commits intopython:mainfrom
jkunimune:patch-3

Conversation

@jkunimune
Copy link
Contributor

@jkunimunejkunimune commentedMar 3, 2026
edited by github-actionsbot
Loading

The documentation for the name or flags argument ofargparse.ArgumentParser.add_argument() said

The dest parametre defaults to the argument name with underscores_ replacing hyphens- .

However, this is not true for positional arguments, which retain their hyphens. The documentation for the dest parameter correctly describes this behavior, but a user who only reads the name or flags documentation will be misled.

Thus, I added a qualification to the sentence to make clear that the hyphen relpacement only happens for optional arguments.

The dest parameter defaults to the argument name, with underscores_ replacing hyphens- if the argument is optional.

I'm hoping this change is trivial enough that I don't need to submit an issue first, but let me know if that's incorrect.


📚 Documentation preview 📚:https://cpython-previews--145479.org.readthedocs.build/

The documentation for the name or flags argument of `argparse.ArgumentParser.add_argument()` said> By default, argparse automatically handles the internal naming and display names of arguments … The dest parametre defaults to the argument name with underscores `_` replacing hyphens `-` .However, this is not true for positional arguments, which retain their hyphens.  The documentation for the dest parameter correctly describes this behavior, but a user who only reads the name or flags documentation will be misled.Thus, I added a qualification to the sentence to make clear that the hyphen relpacement only happens for optional argiments.
Copy link
Member

@savannahostrowskisavannahostrowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Good catch - just a tweak on the phrasing but LGTM! Thank you!

jkunimune reacted with thumbs up emoji
@bedevere-app
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phraseI have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

Co-authored-by: Savannah Ostrowski <savannah@python.org>
@jkunimune
Copy link
ContributorAuthor

I have made the requested changes; please review again.

@bedevere-app
Copy link

Thanks for making the requested changes!

@savannahostrowski: please review the changes made to this pull request.

Copy link
Member

@savannahostrowskisavannahostrowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

One small comment but after that's fixed, I'll merge and backport.

@jkunimune
Copy link
ContributorAuthor

Ah, good point. I just fixed it.

@savannahostrowskisavannahostrowskienabled auto-merge (squash)March 3, 2026 21:35
@savannahostrowskisavannahostrowski merged commitdc12d19 intopython:mainMar 3, 2026
28 checks passed
@github-project-automationgithub-project-automationbot moved this fromTodo toDone inDocs PRsMar 3, 2026
@miss-islington-app
Copy link

Thanks@jkunimune for the PR, and@savannahostrowski for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry,@jkunimune and@savannahostrowski, I could not cleanly backport this to3.13 due to a conflict.
Please backport usingcherry_picker on command line.

cherry_picker dc12d1999b88e84d5a6b8e491be468b73379e54b 3.13

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestMar 3, 2026
…ythonGH-145479)(cherry picked from commit dc12d1999b88e84d5a6b8e491be468b73379e54b)Co-authored-by: Justin Kunimune <justinkunimune@gmail.com>Co-authored-by: Savannah Ostrowski <savannah@python.org>
@bedevere-app
Copy link

GH-145485 is a backport of this pull request to the3.14 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.14bugs and security fixes labelMar 3, 2026
@savannahostrowskisavannahostrowski removed the needs backport to 3.13bugs and security fixes labelMar 3, 2026
@savannahostrowski
Copy link
Member

These docs were added in 3.14 so removing backport to 3.13 label.

savannahostrowski added a commit that referenced this pull requestMar 3, 2026
…ment() (GH-145479) (#145485)Fix incorrect statement about argparse.ArgumentParser.add_argument() (GH-145479)(cherry picked from commitdc12d19)Co-authored-by: Justin Kunimune <justinkunimune@gmail.com>Co-authored-by: Savannah Ostrowski <savannah@python.org>
bkap123 pushed a commit to bkap123/cpython that referenced this pull requestMar 3, 2026
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@savannahostrowskisavannahostrowskisavannahostrowski approved these changes

Labels

docsDocumentation in the Doc dirskip issueskip news

Projects

Status: Done

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@jkunimune@savannahostrowski@StanFromIreland

[8]ページ先頭

©2009-2026 Movatter.jp