-
-
Notifications
You must be signed in to change notification settings - Fork 31.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-37908: Add an example of ArgumentParser.exit() #15455
Conversation
Co-Authored-By: Brandt Bucher <[email protected]>
Co-Authored-By: Brandt Bucher <[email protected]>
cc @rhettinger |
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 |
Doc/library/argparse.rst
Outdated
@@ -2006,10 +2006,11 @@ Exiting methods | |||
this method to handle these steps differently:: | |||
|
|||
import sys | |||
|
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.
two lines of space?
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.
just one line,
import sys
class ErrorCatchingArgumentParser(argparse.ArgumentParser):
pass
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.
I check some other examples in rst, single line is fine.
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.
Yet the rst indentation is wrong (single space)
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.
@JulienPalard And i think it is confusing some users too :(.
I found some code examples in rst using >>>
and the others don't using >>>
like this example. it is confusing too(i don't have time to look the details.)
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.
Blocks with '>>>' are here to demostrate an interactive session (when the responses are important), like:
>>> 1.2 - 1.0
0.19999999999999996
The ones with no '>>>' are to demonstrate code (implementation of classes, functions, ...) when there is typically no result, like:
def foo(x, y):
return 5 * x - 3 * y
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.
Oh, thanks, Julien Palard. First time to know the difference.
@matrixise oh, forgive me to cover your patch, i reverse to your patch. |
Please, stop to change the code, because your PR was ok, and Travis restart a new job at each push. and Travis is not quick ;-) |
Forgive me. I stop changing the code now.
|
Nice, thank you |
Thanks @shihai1991 for the PR, and @matrixise for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8. |
GH-16065 is a backport of this pull request to the 3.8 branch. |
Co-Authored-By: Brandt Bucher <[email protected]> (cherry picked from commit b1a2abd) Co-authored-by: Hai Shi <[email protected]>
Thanks a million, guys. Looks all my PR which waiting core developer review have been merged. |
https://bugs.python.org/issue37908