-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
Improve asyncio.loop.call_soon() documentation #20883
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
8ffedc3
Update asyncio-eventloop.rst
akindofyoga 305ad6f
Update asyncio-eventloop.rst
akindofyoga 084bbc5
Update asyncio-eventloop.rst
akindofyoga 97b04a3
Update asyncio-eventloop.rst
akindofyoga d1a435a
Update asyncio-eventloop.rst
akindofyoga 36936b6
Update asyncio-dev.rst
akindofyoga bf275d3
Update asyncio-dev.rst
akindofyoga 1da8579
Update asyncio-eventloop.rst
akindofyoga f436584
Update glossary.rst
akindofyoga f5b7a7e
Update asyncio-eventloop.rst
akindofyoga 57a50e4
Update asyncio-dev.rst
akindofyoga 1697900
Update asyncio-dev.rst
akindofyoga 61dc896
Update asyncio-eventloop.rst
akindofyoga ec4e0c6
Fix trailing whitespace error
akindofyoga fce21c7
Update Doc/library/asyncio-dev.rst
akindofyoga File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
While I think this is a substantial improvement over the previous iteration, I would very much prefer to explain that callbacks are subroutine/non-coroutine functions in the Python glossary for "callback", as it universally applies to anything that uses the term in the python docs (including several other areas in the asyncio docs). So rather than repeating it every time we mention callbacks, I think it makes more sense to clarify it in the glossary definition and link to there.
Uh oh!
There was an error while loading. Please reload this page.
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.
Thank you for taking the time to write out the detailed explanation above! I really appreciate it and it was very helpful. Indeed, I think specifying subroutine function, rather than just function would fix the ambiguity for me. Would this pull request be a good place for me to add that to the glossary and link it in these docs? Or should I define coroutine in the glossary in a separate PR?
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.
Also, I think that "synchronous callback" might be a bit misleading or cause some confusion, as a callback can definitely be asynchronous depending on how it is used, such as with
Future.add_done_callback()
. The function itself passed as a callback is not a coroutine/"async def" function and might be considered "synchronous" in that sense, but the operation is asynchronous since it is happening out of order from the main "flow" of the program.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.
No problem, I'm glad to hear it was helpful. :-)
Either way works, but it would probably be easier to do it in the same PR. Just make sure to avoid anything that would require a force-push, since it could overwrite the history of the PR and remove some of the review comments (which loses some context for anyone looking in the future).
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.
Ok. I added a glossary definition for callback and referenced it from
asyncio-eventloop
andasyncio-dev
.