On Oct 3, 2016 7:09 PM, "Stephen J. Turnbull" <
turnbull.stephen...@u.tsukuba.ac.jp> wrote:
>
> Rene Nejsum writes:
>
>  > I believe that you should be able to code concurrent code, without
>  > being to explicit about it, but let the runtime handle low-level
>  > timing, as long as you know your code will execute in the intended
>  > order.
>
> Isn't "concurrent code whose order of execution you know" an oxymoron?

They are referring to the synchronous nature of any independent control
state. Whether it's a thread, a coroutine, a continuation, or whatever else
doesn't really matter much. When a thing runs concurrently along side other
things, it's still synchronous with respect to itself regardless of how
many context switches occur before completion. Such things only need
mechanisms to synchronize in order to cooperate.

People want to know how they are suppose to write unified,
non-insane-and-ugly code in this a/sync python 2/3 world we now find
ourselves in. I've been eagerly watching this thread for the answer, thus
far to no avail.

Sans-io suggests we write bite-sized synchronous code that can be driven by
a/sync consumers. While this is all well and good, how does one write said
consuming library for both I/O styles without duplication?

The answer seems to be "write everything you ever wanted as async and throw
some sync wrappers around it". Which means all the actual code I write will
be peppered with async and await keywords.

In Go I can spawn a new control state (goroutine) at any time against any
function. This is clear in the code. In Erlang I can spawn a new control
state (Erlang process) at any time and it's also clear. Erlang is a little
different because it will preempt me, but the point is I am simply choosing
a target function to run in a new context. Gevent and even threading module
is another example of this pattern.

In all reality you don't typically need many suspension points other than
around I/O, and occasionally heavy CPU, so I think folks are struggling to
understand (I admit, myself included) why the runtime doesn't want to be
more help and instead punts back to the developer.

-- 

C Anthony
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to