The use of `await` is on purpose to signal to you as a developer that the event loop may very well pause at that point and context switch to another coroutine. Take that away and you lose that signal. You also would never know from your code whether you need to have an event loop running or not to make such a call.
On Fri, Jun 12, 2020 at 2:03 PM J. Pic <j...@yourlabs.org> wrote: > Hi all, > > Just wonder what it would look like if coroutines where awaited by > default, you would only have to use "noawait" when you do *not* want to > await a coroutine ? > > async def test(): > return do_something() > > # it's awaited here by default: we get the result and not a coroutine > result1 = test() > > # not awaiting here because you want to do_something_else > coroutine = noawait test() > do_something_else() > result2 = await coroutine > > Then, you could be chaining code again like this: > > foo_of_result = test().foo > > Instead of: > > foo_of_result = (await test()).foo > > Thank you in advance for your replies > > Have a great weekend ! > > -- > ∞ > _______________________________________________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/TZAVYTSA6MSMTJWODXIINT3OWMR5LQS4/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/25E2UHUHUOIXE5ZB3EEHDVNFNV5WEHTD/ Code of Conduct: http://python.org/psf/codeofconduct/