Skip to content

Comments

Update argparse suggest_on_error code snippet in docs#144985

Merged
savannahostrowski merged 3 commits intopython:mainfrom
savannahostrowski:update-example
Feb 23, 2026
Merged

Update argparse suggest_on_error code snippet in docs#144985
savannahostrowski merged 3 commits intopython:mainfrom
savannahostrowski:update-example

Conversation

@savannahostrowski
Copy link
Member

@savannahostrowski savannahostrowski commented Feb 19, 2026

The current example incorrectly shows integer literals in the parse_args() list (i.e., the code is actually invalid and results in a TypeError) and uses a confusing type=int conversion that isn't relevant to demonstrating suggest_on_error.

This PR simplifies the example to use realistic string choices without the unnecessary type conversion.

Reader's note: I was the one who originally added this example to the docs in #124456 🤦‍♀️


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

@savannahostrowski savannahostrowski enabled auto-merge (squash) February 23, 2026 17:19
@savannahostrowski savannahostrowski merged commit 6194a55 into python:main Feb 23, 2026
29 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Feb 23, 2026
@miss-islington-app
Copy link

Thanks @savannahostrowski for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @savannahostrowski, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 6194a552f2b010e1dcdd006996f613c956520124 3.14

savannahostrowski added a commit to savannahostrowski/cpython that referenced this pull request Feb 23, 2026
@bedevere-app
Copy link

bedevere-app bot commented Feb 23, 2026

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

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Feb 23, 2026
@bedevere-app
Copy link

bedevere-app bot commented Feb 23, 2026

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

savannahostrowski added a commit that referenced this pull request Feb 23, 2026
…4985) (#145151)

Update argparse `suggest_on_error` code snippet in docs (#144985)

(cherry picked from commit 6194a55)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip issue skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant