Skip to content

Update argparse suggest_on_error code snippet in docs#144985

Open
savannahostrowski wants to merge 2 commits intopython:mainfrom
savannahostrowski:update-example
Open

Update argparse suggest_on_error code snippet in docs#144985
savannahostrowski wants to merge 2 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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant

Comments