Skip to content

The documentation about asyncio.TaskGroup might portray it as a replacement for asyncio.gather #98641

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

Closed
why-not-try-calmer opened this issue Oct 25, 2022 · 5 comments
Labels
3.11 only security fixes 3.12 only security fixes docs Documentation in the Doc dir topic-asyncio

Comments

@why-not-try-calmer
Copy link
Contributor

why-not-try-calmer commented Oct 25, 2022

Documentation

I think the documentation be slightly adjusted to rule out the (possible) implication that asyncio.TaskGroup is a drop-in replacement / better alternative to asyncio.gather(). Both have their idiomatic uses cases, and asyncio.gather() works well for tasks that do not schedule tasks themselves, especially when the caller needs to consume their result as soon as possible (i.e.

re1, re2 = asyncio.gather(corou1(), corou2())

)

I have a branch implementing the proposed changed ready to be PR-ed

Linked PRs

@why-not-try-calmer why-not-try-calmer added the docs Documentation in the Doc dir label Oct 25, 2022
@bedevere-bot

This comment was marked as off-topic.

@bedevere-bot

This comment was marked as off-topic.

@bedevere-bot

This comment was marked as off-topic.

@zware zware changed the title [3.11] The documentation about asyncio.TaskGroup might portray it as a replacement for asyncio.gather The documentation about asyncio.TaskGroup might portray it as a replacement for asyncio.gather Oct 25, 2022
@zware zware added 3.11 only security fixes 3.12 only security fixes labels Oct 25, 2022
@ezio-melotti ezio-melotti moved this to Todo in asyncio Oct 28, 2022
@kumaraditya303
Copy link
Contributor

I am not sure that we to explicitly say this, it depends on the user how they want to use it. For most part asyncio.TaskGroup is much better than gather.

@gvanrossum
Copy link
Member

I just closed the PR, closing this as won't fix.

@gvanrossum gvanrossum closed this as not planned Won't fix, can't repro, duplicate, stale Apr 20, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in asyncio Apr 20, 2023
gvanrossum pushed a commit that referenced this issue Apr 20, 2023
The purpose of the comments is to rule out the implication that asyncio.TaskGroup is a drop-in replacement / better alternative to asyncio.gather().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.11 only security fixes 3.12 only security fixes docs Documentation in the Doc dir topic-asyncio
Projects
Status: Done
Development

No branches or pull requests

5 participants