[Python-ideas] async objects

Paul Moore p.f.moore at gmail.com
Wed Oct 5 17:02:52 EDT 2016


On 5 October 2016 at 21:28, Rene Nejsum <rene at stranden.com> wrote:
> But, are the runtimes for Python and Erlang that fundamentally different? Is it Python’s tight integration with C that is the big difference?

I don't know *that* much about Erlang, but Python's model is that of a
single shared address space with (potentially multiple) threads of
code running, having access to that address space. Erlang's model is
that of multiple threads of execution (processes) that are isolated
from each other (they have independent address spaces). That's a
pretty fundamental difference, and gets right to the heart of why
async is fundamentally different in the two languages. It also shows
in Erlang's C FFI, which as I understand it is to have the C code
isolated in a separate "process", and the user's program communicating
with it through channels. As far as I can see, that's a direct
consequence of the fact that you couldn't safely expect to call a C
function (with its direct access to the whole address space) direct
from an Erlang process.

Python's model is very similar to C (and Java, and C#/.net, and many
other "traditional" languages [1]). That's not "to make it easier to
call C functions", it's just because it was a familiar and obvious
model to use, known to work well, when Python was first developed. The
fact that it made calling C from Python easy was a side effect - one
that helped make Python as useful and popular as it is today, but
nevertheless simply a side effect of the model.

Paul

[1] And actual computer hardware, which isn't a coincidence :-)


More information about the Python-ideas mailing list