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 — gh-127296: Document that argparse count action starts from a non-zero default by owenthcarey · Pull Request #156908 · python/cpython

Conversation

@owenthcarey

@owenthcarey owenthcarey commented Sep 3, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

The 'count' action adds to whatever value is already in the namespace, so with default=3 a single -v gives 4, not 1. The docs don't say this, and the general description of default reads as if the default is only used when the argument is absent.

This adds one sentence to the 'count' entry saying that a non-zero default is the starting point for the count, as suggested in the issue.

Fixes #127296

  • Issue: Argparse: "default" interacts incorrectly/non-intuitively with action="count" #127296

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Set27 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@owenthcarey
pythongh-127296: Document that argparse count action starts from a no…
8da8655
…n-zero default
@owenthcarey
owenthcarey requested a review from savannahostrowski as a code owner September 3, 2026 19:43
@bedevere-app bedevere-app Bot mentioned this pull request Sep 3, 2026
Argparse: "default" interacts incorrectly/non-intuitively with action="count" #127296
Closed
@bedevere-app bedevere-app Bot added docs Documentation in the Doc dir skip news awaiting review labels Sep 3, 2026
@github-project-automation github-project-automation Bot added this to Docs PRs Sep 3, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Docs PRs Sep 3, 2026
@read-the-docs-community

read-the-docs-community Bot commented Sep 3, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #34409315 | 📁 Comparing 7cb271d against main (c8ea867)

  🔍 Preview build  

7 files changed · ± 7 modified

± Modified

  • c-api/marshal.html
  • library/argparse.html
  • library/difflib.html
  • library/sys.html
  • whatsnew/3.15.html
  • whatsnew/3.16.html
  • whatsnew/changelog.html
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

savannahostrowski
savannahostrowski reviewed Sep 4, 2026
View reviewed changes
Comment thread Doc/library/argparse.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@savannahostrowski savannahostrowski added needs backport to 3.13 only security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Sep 4, 2026
@owenthcarey @savannahostrowski
Update Doc/library/argparse.rst
dcab2c2
Co-authored-by: Savannah Ostrowski <[email protected]>
@owenthcarey

owenthcarey commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Thanks! Applied your suggestion.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

savannahostrowski
savannahostrowski approved these changes Sep 5, 2026
View reviewed changes

@savannahostrowski savannahostrowski left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thank you!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Sep 5, 2026
@savannahostrowski
Merge branch 'main' into pythongh-127296-argparse-count-default
7cb271d
@savannahostrowski
savannahostrowski enabled auto-merge (squash) September 5, 2026 16:52
@savannahostrowski
savannahostrowski merged commit 7a91841 into python:main Sep 5, 2026
30 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Sep 5, 2026
@miss-islington-app

miss-islington-app Bot commented Sep 5, 2026

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Sep 5, 2026
@bedevere-app

bedevere-app Bot commented Sep 5, 2026

Copy link
Copy Markdown

GH-156997 is a backport of this pull request to the 3.15 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Sep 5, 2026
@bedevere-app

bedevere-app Bot commented Sep 5, 2026

Copy link
Copy Markdown

GH-156998 is a backport of this pull request to the 3.14 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Sep 5, 2026
@bedevere-app

bedevere-app Bot commented Sep 5, 2026

Copy link
Copy Markdown

GH-156999 is a backport of this pull request to the 3.13 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Sep 5, 2026
savannahostrowski added a commit that referenced this pull request Sep 5, 2026
@miss-islington @owenthcarey @savannahostrowski
[3.14] gh-127296: Document that argparse count action starts from a n…
384ac4d
…on-zero default (GH-156908) (#156998)

gh-127296: Document that argparse count action starts from a non-zero default (GH-156908)
(cherry picked from commit 7a91841)

Co-authored-by: Owen Carey <[email protected]>
Co-authored-by: Savannah Ostrowski <[email protected]>
savannahostrowski added a commit that referenced this pull request Sep 5, 2026
@miss-islington @owenthcarey @savannahostrowski
[3.13] gh-127296: Document that argparse count action starts from a n…
2fa4e32
…on-zero default (GH-156908) (#156999)

gh-127296: Document that argparse count action starts from a non-zero default (GH-156908)
(cherry picked from commit 7a91841)

Co-authored-by: Owen Carey <[email protected]>
Co-authored-by: Savannah Ostrowski <[email protected]>
hugovk pushed a commit that referenced this pull request Sep 7, 2026
@miss-islington @owenthcarey @savannahostrowski
[3.15] gh-127296: Document that argparse count action starts from a n…
3d16dc6
…on-zero default (GH-156908) (#156997)

Co-authored-by: Owen Carey <[email protected]>
Co-authored-by: Savannah Ostrowski <[email protected]>
clin1234 pushed a commit to clin1234/cpython that referenced this pull request Sep 12, 2026
@owenthcarey @savannahostrowski @clin1234
pythongh-127296: Document that argparse count action starts from a no…
e7a5cb7
…n-zero default (python#156908)

Co-authored-by: Savannah Ostrowski <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@savannahostrowski savannahostrowski savannahostrowski approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

docs Documentation in the Doc dir skip news

Projects

Docs PRs
Status: Done

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Argparse: "default" interacts incorrectly/non-intuitively with action="count"

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@owenthcarey @savannahostrowski
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.