-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
Fix mistakes on function coroutines related definitions #9871
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
Forgot to clarify: while async def statements are the preferred way to create routines, generator-based routines still exist (asyncio.coroutine). While generator-based coroutines are slated for removal in 3.10, I think the right thing to do is to be precise about what type of coroutines we are talking about. |
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.
Thanks @andresdelfino 👍
Doc/reference/compound_stmts.rst
Outdated
@@ -707,16 +707,16 @@ Coroutine function definition | |||
keyword: await | |||
|
|||
Execution of Python coroutines can be suspended and resumed at many points | |||
(see :term:`coroutine`). In the body of a coroutine, any ``await`` and | |||
(see :term:`coroutine`). In the body of a coroutine function, any ``await`` and |
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.
In Inside ... any
Doc/reference/compound_stmts.rst
Outdated
It is a :exc:`SyntaxError` to use ``yield from`` expressions in | ||
``async def`` coroutines. | ||
It is a :exc:`SyntaxError` to use a ``yield from`` expression inside an | ||
``async def`` statement. |
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.
Would it be better to use function body
instead of statement
?
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.
Yes, I like it better :)
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'll do a small rewording, let me know if it is ok.
Thanks @andresdelfino for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7. |
GH-10170 is a backport of this pull request to the 3.7 branch. |
Fix a bug I introduced in pythonGH-9864 by which coroutines are treated as synonymous of function coroutines. Also, fix the same mistake (coroutines == function coroutines) already present in other parts of the reference. I'm very sorry for the hassle. (cherry picked from commit 95f68b1) Co-authored-by: Andrés Delfino <[email protected]>
Fix a bug I introduced in GH-9864 by which coroutines are treated as synonymous of function coroutines. Also, fix the same mistake (coroutines == function coroutines) already present in other parts of the reference. I'm very sorry for the hassle. (cherry picked from commit 95f68b1) Co-authored-by: Andrés Delfino <[email protected]>
Fix a bug I introduced in #9864 by which coroutines are treated as synonymous of function coroutines.
Also, fix the same mistake (coroutines == function coroutines) already present in other parts of the reference.
I'm very sorry for the hassle.