gh-132558: Improve argparse docs on combining type and choices#133827
gh-132558: Improve argparse docs on combining type and choices#133827savannahostrowski merged 8 commits intopython:mainfrom
argparse docs on combining type and choices#133827Conversation
argparse docs on combining type and choices
| Formatted choices override the default *metavar* which is normally derived | ||
| from *dest*. This is usually what you want because the user never sees the | ||
| *dest* parameter. If this display isn't desirable (perhaps because there are | ||
| many choices), just specify an explicit metavar_. |
There was a problem hiding this comment.
This should not be inbetween the choices notes.
There was a problem hiding this comment.
It was already with the choices documentation. Where would you move it to?
There was a problem hiding this comment.
You should move the text you added above it.
Doc/library/argparse.rst
Outdated
| Use of :class:`enum.Enum` is not recommended because it is difficult to | ||
| control its appearance in these messages. |
There was a problem hiding this comment.
I think it's previous place was fine, it continued naturally from the previous point.
Co-authored-by: Savannah Bailey <savannahostrowski@gmail.com>
savannahostrowski
left a comment
There was a problem hiding this comment.
Just adding a new line back but otherwise, I think this looks good to go.
|
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 And if you don't make the requested changes, you will be put in the comfy chair! |
|
Thanks @hansthen for the PR, and @savannahostrowski for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
…ices` (pythonGH-133827) (cherry picked from commit dd0840b) Co-authored-by: Hans Then <hans.then@gmail.com> Co-authored-by: Savannah Bailey <savannahostrowski@gmail.com>
…ices` (pythonGH-133827) (cherry picked from commit dd0840b) Co-authored-by: Hans Then <hans.then@gmail.com> Co-authored-by: Savannah Bailey <savannahostrowski@gmail.com>
|
GH-139057 is a backport of this pull request to the 3.14 branch. |
|
GH-139058 is a backport of this pull request to the 3.13 branch. |
This clarifies the documentation a bit to warn users of the potential side effects of using both
typeandchoiceson an action. It also suggests that it is better in those cases to do type conversion in application code.choiceswithtype#132558📚 Documentation preview 📚: https://cpython-previews--133827.org.readthedocs.build/