Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail From: ram@zedat.fu-berlin.de (Stefan Ram) Newsgroups: comp.lang.python Subject: Re: Await expressions Date: 1 Feb 2024 10:09:10 GMT Organization: Stefan Ram Lines: 25 Expires: 1 Dec 2024 11:59:58 GMT Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de Nfav8k7c2jAIfjpwZuHmCA4GyFIpE8pnuR+G9ZMb0A4Q5f Cancel-Lock: sha1:jW3T6UMF7CGkm5mZWw9sQa1pqK0= sha256:PEH7Yp0Fe1gKHZdDhrYk2mThM4vN6fbyrxZ/uf/zZlI= X-Copyright: (C) Copyright 2024 Stefan Ram. All rights reserved. Distribution through any means other than regular usenet channels is forbidden. It is forbidden to publish this article in the Web, to change URIs of this article into links, and to transfer the body without this notice, but quotations of parts in other Usenet posts are allowed. X-No-Archive: Yes Archive: no X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some services to mirror the article in the web. But the article may be kept on a Usenet archive server with only NNTP access. X-No-Html: yes Content-Language: en-US Accept-Language: de-DE-1901, en-US, it, fr-FR ram@zedat.fu-berlin.de (Stefan Ram) writes: >In "The Python Language Reference, Release 3.13.0a0", >there is this section: >|6.4 Await expression >|Suspend the execution of coroutine on an awaitable object. >|Can only be used inside a coroutine function. >|await_expr ::= "await" primary A wording I like is what I found in the World-Wide Web where Victor Skvortsov wrote: |When we await on some object, await first checks whether the |object is a native coroutine or a generator-based coroutine, |in which case it "yields from" the coroutine. Otherwise, it |"yields from" the iterator returned by the object's |__await__() method. Victor Skvortsov (2021). This actually explains "to wait on some object" (which might be the same as to "suspend on some object"), and I was not able to find such an explanation in the venerable Python Language Reference! Heck, even of the respected members of this newsgroup, IIRC, no one mentioned "__await__". So, let's give a big shoutout to Victor!