Minor documentation fix: incorrect statement about argparse.ArgumentParser.add_argument()#145479
Minor documentation fix: incorrect statement about argparse.ArgumentParser.add_argument()#145479savannahostrowski merged 4 commits intopython:mainfrom
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.
Good catch - just a tweak on the phrasing but LGTM! Thank you!
|
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>
|
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.
One small comment but after that's fixed, I'll merge and backport.
|
Ah, good point. I just fixed it. |
|
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 dc12d19) 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 the 3.14 branch. |
|
These docs were added in 3.14 so removing backport to 3.13 label. |
…ython#145479) Co-authored-by: Savannah Ostrowski <savannah@python.org>
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/