Skip to content

asyncio.Queue.task_done documentation is ambiguous #124433

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
enok71 opened this issue Sep 24, 2024 · 8 comments · Fixed by #128669
Closed

asyncio.Queue.task_done documentation is ambiguous #124433

enok71 opened this issue Sep 24, 2024 · 8 comments · Fixed by #128669
Labels
docs Documentation in the Doc dir topic-asyncio

Comments

@enok71
Copy link

enok71 commented Sep 24, 2024

Documentation

When reading https://docs.python.org/3/library/asyncio-queue.html the reader gets no clue to the fact that this object is (primarily) meant to contain tasks. (Because it is, isn't it? The task_done() method seems to indicate that)

Linked PRs

@enok71 enok71 added the docs Documentation in the Doc dir label Sep 24, 2024
@github-project-automation github-project-automation bot moved this to Todo in asyncio Sep 24, 2024
@ZeroIntensity
Copy link
Member

No, an asyncio.Queue is just the asynchronous analogue of queue.Queue. It can hold any object, not just tasks. In this case, task_done is just badly named -- it's not really related to asyncio.Task, it's the equivalent of Queue.task_done.

I think this is a good indicator that the excerpt under asyncio.Queue.task_done should get reworded, the term "task" in the context of asyncio refers to a future, not a thread doing something to a queue.

@ZeroIntensity ZeroIntensity changed the title asyncio.queues documentation should mention what it's supposed to contain asyncio.Queue.task_done documentation is ambiguous Sep 24, 2024
@enok71
Copy link
Author

enok71 commented Sep 24, 2024

In here it looks like the asyncio.queue is intended to be a "high-level API" to "distribute tasks"

@ZeroIntensity
Copy link
Member

You can do that, but that isn't their sole purpose.

@JelleZijlstra
Copy link
Member

"Task" here generally means "a thing to do", not "asyncio.Task".

@ZeroIntensity
Copy link
Member

Yeah, that's why it's confusing in the context of asyncio.Queue

@enok71
Copy link
Author

enok71 commented Sep 24, 2024

Wouldn't hurt to say something on the subject in the docs then.

@ZeroIntensity
Copy link
Member

Would you like to author the PR? (If not, I can deal with it.)

@enok71
Copy link
Author

enok71 commented Sep 24, 2024

Feel free. I don't know the subject well enough.

@kumaraditya303 kumaraditya303 linked a pull request Jan 9, 2025 that will close this issue
@github-project-automation github-project-automation bot moved this from Todo to Done in asyncio Jan 9, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jan 9, 2025
)

(cherry picked from commit 4322a31)

Co-authored-by: Kumar Aditya <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jan 9, 2025
)

(cherry picked from commit 4322a31)

Co-authored-by: Kumar Aditya <[email protected]>
kumaraditya303 added a commit that referenced this issue Jan 9, 2025
…128672)

gh-124433: fix docs for `asyncio.Queue.task_done` (GH-128669)
(cherry picked from commit 4322a31)

Co-authored-by: Kumar Aditya <[email protected]>
kumaraditya303 added a commit that referenced this issue Jan 9, 2025
…128671)

gh-124433: fix docs for `asyncio.Queue.task_done` (GH-128669)
(cherry picked from commit 4322a31)

Co-authored-by: Kumar Aditya <[email protected]>
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 topic-asyncio
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants