Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #102695 > unrolled thread
| Started by | Marko Rauhamaa <marko@pacujo.net> |
|---|---|
| First post | 2016-02-09 00:13 +0200 |
| Last post | 2016-02-10 18:44 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
Asyncio thought experiment Marko Rauhamaa <marko@pacujo.net> - 2016-02-09 00:13 +0200
Re: Asyncio thought experiment "Sven R. Kunze" <srkunze@mail.de> - 2016-02-10 18:44 +0100
| From | Marko Rauhamaa <marko@pacujo.net> |
|---|---|
| Date | 2016-02-09 00:13 +0200 |
| Subject | Asyncio thought experiment |
| Message-ID | <87oabqq2a0.fsf@elektro.pacujo.net> |
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. Marko
[toc] | [next] | [standalone]
| From | "Sven R. Kunze" <srkunze@mail.de> |
|---|---|
| Date | 2016-02-10 18:44 +0100 |
| Message-ID | <mailman.16.1455126257.22075.python-list@python.org> |
| In reply to | #102695 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web