Skip to content
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

Merged
merged 11 commits into from
Sep 12, 2019

Conversation

shihai1991
Copy link
Member

@shihai1991 shihai1991 commented Aug 24, 2019

@bedevere-bot bedevere-bot added docs Documentation in the Doc dir awaiting review labels Aug 24, 2019
@shihai1991 shihai1991 changed the title bpo-37908: Add an example of ArgumentParser.Exit() bpo-37908: Add an example of ArgumentParser.exit() Aug 24, 2019
shihai1991 and others added 2 commits August 25, 2019 16:38
@shihai1991
Copy link
Member Author

cc @rhettinger

@bedevere-bot
Copy link

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 I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@@ -2006,10 +2006,11 @@ Exiting methods
this method to handle these steps differently::

import sys

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two lines of space?

Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member

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)

Copy link
Member Author

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.)

Copy link
Member

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

Copy link
Member Author

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.

@shihai1991
Copy link
Member Author

@matrixise oh, forgive me to cover your patch, i reverse to your patch.

@matrixise
Copy link
Member

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 ;-)

@shihai1991
Copy link
Member Author

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.

def exit(self, status=0, message=None) lack a colon at the end, i updated it.

@matrixise
Copy link
Member

Nice, thank you

@matrixise matrixise merged commit b1a2abd into python:master Sep 12, 2019
@miss-islington
Copy link
Contributor

Thanks @shihai1991 for the PR, and @matrixise for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-16065 is a backport of this pull request to the 3.8 branch.

@shihai1991 shihai1991 deleted the bpo_37908 branch September 12, 2019 15:41
miss-islington added a commit that referenced this pull request Sep 12, 2019
Co-Authored-By: Brandt Bucher <[email protected]>
(cherry picked from commit b1a2abd)

Co-authored-by: Hai Shi <[email protected]>
@shihai1991
Copy link
Member Author

Thanks a million, guys. Looks all my PR which waiting core developer review have been merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants