Asyncio thought experiment

Sven R. Kunze srkunze at mail.de
Wed Feb 10 12:44:14 EST 2016


On 08.02.2016 23:13, Marko Rauhamaa wrote:
> As I stated in an earlier post, a normal subroutine may turn out to be
> blocking. To make it well-behaved under asyncio, you then dutifully tag
> the subroutine with "async" and adorn the blocking statement with
> "await". Consequently, you put "await" in front of all calls to the
> subroutine and cascade the "async"s and "await"s all the way to the top
> level.
>
> Now what would prevent you from making *every* function an "async" and
> "await"ing *every* function call? Then, you would never fall victim to
> the cascading async/await.
>
> And if you did that, why bother sprinkling async's and await's
> everywhere? Why not make every single function call an await implicitly
> and every single subroutine an async? In fact, that's how everything
> works in multithreading: blocking statements don't need to be ornamented
> in any manner.

So? :)

Best,
Sven



More information about the Python-list mailing list