[Python-ideas] async objects
Sven R. Kunze
srkunze at mail.de
Tue Oct 4 12:40:28 EDT 2016
On 04.10.2016 09:50, Stephen J. Turnbull wrote:
> As I understand the main point, Sven and Rene don't believe that [the
> kind of] async code [they want to write] should need any keywords;
> just start the event loop and invoke functions, and that somehow
> automatically DTRTs.
[reading my name second time]
I don't think that's actually what I wanted here. One simple keyword
should have sufficed just like golang did. So, the developer gets a way
to decide whether or not he needs it blocking or nonblocking **when
using a function**. He doesn't need to decide it **when writing the
function**.
You might wonder why this is relevant. DRY principle has been mentioned
but there's more to it. Only the caller **can decide** whether it needs
to wait or not. Why? Because, the caller works WITH the result of the
called function (whatever results means to you). The caller is (what
Nick probably would call) the orchestrator, as it has the knowledge
about the relation and interaction between domain-specific function calls.
As a result of past discussions, I wrote the module "xfork" which
basically does this "golang goroutine" stuff. It's just a thin wrapper
around "futures" but it allows to avoid that what René and Anthony
objects about.
Cheers,
Sven
More information about the Python-ideas
mailing list