Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34.2k
Minor documentation fix: incorrect statement about argparse.ArgumentParser.add_argument()#145479
Conversation
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.
savannahostrowski left a comment
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.
Good catch - just a tweak on the phrasing but LGTM! Thank you!
Uh oh!
There was an error while loading.Please reload this page.
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 phrase |
Co-authored-by: Savannah Ostrowski <savannah@python.org>
jkunimune commentedMar 3, 2026
I have made the requested changes; please review again. |
Thanks for making the requested changes! @savannahostrowski: please review the changes made to this pull request. |
savannahostrowski left a comment
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.
One small comment but after that's fixed, I'll merge and backport.
Uh oh!
There was an error while loading.Please reload this page.
jkunimune commentedMar 3, 2026
Ah, good point. I just fixed it. |
dc12d19 intopython:mainUh oh!
There was an error while loading.Please reload this page.
Thanks@jkunimune for the PR, and@savannahostrowski for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
Sorry,@jkunimune and@savannahostrowski, I could not cleanly backport this to |
…ythonGH-145479)(cherry picked from commit dc12d1999b88e84d5a6b8e491be468b73379e54b)Co-authored-by: Justin Kunimune <justinkunimune@gmail.com>Co-authored-by: Savannah Ostrowski <savannah@python.org>
GH-145485 is a backport of this pull request to the3.14 branch. |
savannahostrowski commentedMar 3, 2026
These docs were added in 3.14 so removing backport to 3.13 label. |
…ython#145479)Co-authored-by: Savannah Ostrowski <savannah@python.org>
Uh oh!
There was an error while loading.Please reload this page.
The documentation for the name or flags argument of
argparse.ArgumentParser.add_argument()saidHowever, 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.
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/