Issue 36428: Support AutoAwait? - Python tracker (original) (raw)

Issue36428

Created on 2019-03-25 23:49 by gvanrossum, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (4)
msg338840 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2019-03-25 23:49
I just found out about IPython's autoawait feature: https://ipython.readthedocs.io/en/stable/interactive/autoawait.html I wonder if we should at least help them do this right in Python 3.8 by having a flag to compile() that allows `await` in the toplevel syntax? It looks like a relatively small change would suffice to make compiler_visit_expr1() in Python/compile.c accept (and generate correct code for) Await_kind outside async functions, if some flag is set.
msg338841 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2019-03-25 23:50
Absolutely. I think there's another open issue for this and I even have a dev branch somewhere with this idea half implemented. Definitely something to have in 3.8.
msg338842 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-03-26 00:03
I think this is same as . The issue talks about the workarounds IPython has to use for the feature and links to the PR where it was implemented https://github.com/ipython/ipython/pull/11265 . I never knew about this feature and this will be very helpful to have especially it reduces boilerplate in having async functions for await calls though asyncio.run improved setting up loop part. Helps in playing around with API in repl during learning with top level await expressions allowed in repl.
msg338843 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2019-03-26 00:05
Oh, you're right. Thanks! Closing in favor of .
History
Date User Action Args
2022-04-11 14:59:13 admin set github: 80609
2019-03-26 00:09:01 xtreak set superseder: implement "Async exec"
2019-03-26 00:05:56 gvanrossum set status: open -> closedresolution: duplicatemessages: + stage: resolved
2019-03-26 00:03:32 xtreak set nosy: + xtreakmessages: +
2019-03-25 23:50:59 yselivanov set messages: +
2019-03-25 23:49:29 gvanrossum create