[New-bugs-announce] [issue34518] Documentation for coroutine objects
report at bugs.python.org
Mon Aug 27 04:44:48 EDT 2018
New submission from Hrvoje Nikšić <hniksic at gmail.com>:
Coroutine objects have public methods such as send, close, and throw, which do not appear to be documented. For example, at https://stackoverflow.com/q/51975658/1600898 a StackOverflow user asks how to abort an already created (but not submitted) coroutine without a RuntimeWarning, with the answer being to use the close() method. The user asked where does one find the close method.
Currently methods only appear to be documented in PEP 492, referring to generator documentation for details. The glossary entry for coroutine (object) links to PEP 492 and to the async def statement. Various places in the documentation, e.g. the index, link to https://docs.python.org/3/library/asyncio-task.html#coroutine but that page is mostly concerned with the usage of coroutines within asyncio, where the methods on individual coroutine objects should not be used.
I would expect to find documentation on coroutine objects under built-in types, https://docs.python.org/3/library/stdtypes.html .
In comparison, generator-iterator methods are documented in the language reference:
assignee: docs at python
nosy: docs at python, hniksic
title: Documentation for coroutine objects
versions: Python 3.7
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce