-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
bpo-36999: Add asyncio.Task.get_coro() #13680
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
Conversation
Doc/library/asyncio-task.rst
Outdated
@@ -842,6 +842,12 @@ Task Object | |||
The *file* argument is an I/O stream to which the output | |||
is written; by default output is written to :data:`sys.stderr`. | |||
|
|||
.. method:: get_coro() | |||
|
|||
Return the coroutine object that was passed to the constructor. |
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 dislike mentioning constructor
here.
Above we have the text:
Use the high-level :func:`asyncio.create_task` function to create
Tasks, or the low-level :meth:`loop.create_task` or
:func:`ensure_future` functions. Manual instantiation of Tasks
is discouraged.
Maybe rephrase this line to Return the coroutine object that was used for the task creation.
or something like this?
Sorry, I'm not a native speaker. Don't insist on the exact wording but you've got my idea.
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'd just say this: "Return the coroutine object wrapped by the Task".
Doc/library/asyncio-task.rst
Outdated
@@ -842,6 +842,12 @@ Task Object | |||
The *file* argument is an I/O stream to which the output | |||
is written; by default output is written to :data:`sys.stderr`. | |||
|
|||
.. method:: get_coro() | |||
|
|||
Return the coroutine object that was passed to the constructor. |
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.
Return the coroutine object that was passed to the constructor. | |
Return the coroutine object wrapped by the :class:`Task`. |
@1st1 like this?
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.
Yeah, I think it's great. If you have time just merge Alex's PR and we can fix this ourselves. Up to you.
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 changed the wording now as requested.
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.
Great!
Thanks! |
https://bugs.python.org/issue36999