Skip to content

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

Merged
merged 2 commits into from
Oct 28, 2018

Conversation

andresdelfino
Copy link
Contributor

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.

@andresdelfino
Copy link
Contributor Author

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.

Copy link
Contributor

@willingc willingc left a comment

Choose a reason for hiding this comment

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

Thanks @andresdelfino 👍

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

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

In Inside ... any

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.
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

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.

@miss-islington
Copy link
Contributor

Thanks @andresdelfino for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-10170 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 28, 2018
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]>
miss-islington added a commit that referenced this pull request Oct 28, 2018
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]>
@andresdelfino andresdelfino deleted the patch-8 branch October 28, 2018 13:55
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 issue skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants