-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Fix and improve asyncio.run()
docs
#16403
Conversation
@1st1 I think it's useful to explicitly mention that a My main concern is just addressing the typo though, so if you want to remove the |
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.
changes in runners.py appear to be musindented
@1st1 Done. I fixed the indent in the docs earlier, but forgot to do it in runners.py, good catch. |
I also replaced the header of the docstring "Run a coroutine" with "Execute the coroutine coro and return the result". I would argue that "Run a coroutine" could be gathered from the name of the function and parameter alone. OTH, "Execute the coroutine coro and return the result" provides a bit more information while still remaining succinct. I can remove this change if needed, but I think it provides a decent improvement and keeps the docstring in sync with the docs. |
@1st1 The recommended changes have been applied. Thanks for the in-depth review. I'd much rather see this go through multiple revisions and be as high quality as possible, instead of having the PR merged more quickly. The former provides far more value to the users of asyncio. |
On second thought, I'll remove coro from the docstring. Since name of the parameter is technically main within runners.py, it wouldn't make sense have coro there. |
Looks good. Please double-check how |
Would |
I think this name would make more sense, but it would be a bit odd if the .rst wasn't consistent with the actual name of the parameter in runners.py (which was @asvetlov's main concern I believe). Are we able to change the actual parameter name in runners.py without causing backwards compatibility issues? Since we didn't specify the "/" positional only symbol from PEP 570, users could technically call However, that might not be an issue if the parameter name main was never officially documented in the .rst, therefore making it not a part of the public API. |
No problem, I'll build the html locally to make sure the link works properly.
Clicking the link correctly leads to the glossary entry: I believe the situation you were referring to was probably where the word was "coroutines", so you had to use:
Something like this
wouldn't work because there is not a literal term in the glossary for "coroutines". That's a pretty commonly occurring issue with Sphinx, since the link target is very literal. |
Looking at the glossary entry made me realize there's a minor typo in it that I hadn't noticed before. "Coroutines is a more generalized form of subroutines" should be "Coroutines are a more generalized form of subroutines". I'll add the correction to this PR, since it's just fixing a single word. That wouldn't be worth it's own PR, but might as well be fixed. |
@1st1 Is there anything left to do with this PR? It's currently blocking #16360 since I'll need to resolve a merge conflict. Neither are particularly time sensitive by any means, I just wanted to wrap these up before we start working on the new streaming API for 3.9. Edit: The only part left was resolving the maincoro idea (#16403 (comment)). |
Thanks @aeros167 for the PR, and @1st1 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8. |
GH-16504 is a backport of this pull request to the 3.8 branch. |
And... merged. Thank you, Kyle! |
GH-16505 is a backport of this pull request to the 3.7 branch. |
(cherry picked from commit e407013) Co-authored-by: Kyle Stanley <[email protected]>
Thanks! |
(cherry picked from commit e407013) Co-authored-by: Kyle Stanley <[email protected]>
(cherry picked from commit e407013) Co-authored-by: Kyle Stanley <[email protected]>
This PR is based on the suggestions I made in #16337 (comment), which were approved of by @asvetlov.