This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Mention of __await__ missing in Coroutine Abstract Methods
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.7, Python 3.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: docs@python Nosy List: asvetlov, docs@python, yahya-abou-imran, yselivanov
Priority: normal Keywords: patch

Created on 2018-01-01 06:06 by yahya-abou-imran, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 5270 closed yahya-abou-imran, 2018-01-22 13:42
Messages (3)
msg309320 - (view) Author: Yahya Abou Imran (yahya-abou-imran) * Date: 2018-01-01 06:06
In the collections.abc documentation:

https://docs.python.org/3/library/collections.abc.html

__await__() doesn't appear in the abstract methods of Coroutine, we see only send() and throw().

But since Coroutine inherit from Awaitable, it's required:


from collections.abc import Coroutine

class MyCoroutine(Coroutine):
    def send(self, value):
        raise StopIteration
    def throw(self, err):
        raise err

mc = MyCoroutine()

Traceback (most recent call last):
  File "_tmp.py", line 9, in <module>
    mc = MyCoroutine()
TypeError: Can't instantiate abstract class MyCoroutine with abstract methods __await__


To be consistent with the rest of the document, this method should appear here to show all the abstract methods, even the inherited ones.
msg309362 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2018-01-02 09:18
`Coroutine` is inherited from `Awaitable`, that's why inherited abstract `__await__` method is present.

It **is** consistent with the rest of the document: e.g. Mapping has no `__len__` method but inherits it from Collection which in turn is inherited from Sized
msg310421 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2018-01-22 13:54
+1 to what Andres said.
History
Date User Action Args
2022-04-11 14:58:56adminsetgithub: 76653
2018-01-22 13:54:43yselivanovsetstatus: open -> closed

nosy: + yselivanov
messages: + msg310421

resolution: not a bug
stage: patch review -> resolved
2018-01-22 13:42:38yahya-abou-imransetkeywords: + patch
stage: patch review
pull_requests: + pull_request5114
2018-01-20 18:12:50asvetlovsetstatus: closed -> open
resolution: not a bug -> (no value)
stage: resolved -> (no value)
2018-01-02 09:18:02asvetlovsetstatus: open -> closed

nosy: + asvetlov
messages: + msg309362

resolution: not a bug
stage: resolved
2018-01-01 06:06:41yahya-abou-imrancreate