[issue41879] Outdated description of async iterables in documentation of async for statement
New submission from Nick Gaya <nicholasgaya+github@gmail.com>: The documentation for the `async for` statement incorrectly states that "An asynchronous iterable is able to call asynchronous code in its iter implementation". Actually, this behavior was deprecated in Python 3.6 and removed in Python 3.7. As of Python 3.7, the `__aiter__()` method must return an asynchronous iterator directly. Suggested fix: Update the `async for` statement description for Python 3.7+ to match the "Asynchronous Iterators" section in the data model documentation.
An :term:`asynchronous iterator` can call asynchronous code in its *next* method.
Relevant documentation: - https://docs.python.org/3/reference/compound_stmts.html#the-async-for-statem... - https://docs.python.org/3/reference/datamodel.html#asynchronous-iterators ---------- assignee: docs@python components: Documentation messages: 377621 nosy: docs@python, nickgaya priority: normal severity: normal status: open title: Outdated description of async iterables in documentation of async for statement versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41879> _______________________________________
Change by Karthikeyan Singaravelan <tir.karthi@gmail.com>: ---------- components: +asyncio nosy: +asvetlov, yselivanov _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41879> _______________________________________
Andrew Svetlov <andrew.svetlov@gmail.com> added the comment: Both mentioned links have the correct code. They use sync __aiter__ and async __anext__ ---------- resolution: -> out of date stage: -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41879> _______________________________________
Change by Nick Gaya <nicholasgaya+github@gmail.com>: ---------- pull_requests: +22427 pull_request: https://github.com/python/cpython/pull/23548 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41879> _______________________________________
Nick Gaya <nicholasgaya+github@gmail.com> added the comment: As described above, the issue is in the textual description, not the code snippet. I have opened a GitHub PR with a fix. ---------- resolution: out of date -> status: closed -> open _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41879> _______________________________________
Andrew Svetlov <andrew.svetlov@gmail.com> added the comment: You are right. ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41879> _______________________________________
miss-islington <mariatta.wijaya+miss-islington@gmail.com> added the comment: New changeset 4b8cdfcb22fbeaab9d954cb693a7fb3362a382b6 by Nick Gaya in branch 'master': bpo-41879: Doc: Fix description of async for statement (GH-23548) https://github.com/python/cpython/commit/4b8cdfcb22fbeaab9d954cb693a7fb3362a... ---------- nosy: +miss-islington _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41879> _______________________________________
Change by miss-islington <mariatta.wijaya+miss-islington@gmail.com>: ---------- keywords: +patch pull_requests: +22607 stage: resolved -> patch review pull_request: https://github.com/python/cpython/pull/23749 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41879> _______________________________________
miss-islington <mariatta.wijaya+miss-islington@gmail.com> added the comment: New changeset be9e4402db64564f7bf0fedb3769cead46c0d4c4 by Miss Islington (bot) in branch '3.9': [3.9] bpo-41879: Doc: Fix description of async for statement (GH-23548) (GH-23749) https://github.com/python/cpython/commit/be9e4402db64564f7bf0fedb3769cead46c... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41879> _______________________________________
participants (4)
-
Andrew Svetlov
-
Karthikeyan Singaravelan
-
miss-islington
-
Nick Gaya