`async def` breaks encapsulation?

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Mar 17 03:32:11 EDT 2020


On 4/03/20 12:52 pm, Marco Sulla wrote:
> Why can't an asynchronous coroutine be simply a coroutine that has an
> `async` or an `await` in its code, without `async` in the signature?

That wouldn't help as much as you seem to think. You still need
to use 'await' whenever you call a coroutine, so switching a
function between coroutine and non-coroutine would still have
just as much of a ripple effect on the rest of your code.

-- 
Greg



More information about the Python-list mailing list