2 ms·
You can "magically" gain a lot of the things Erlang has, by using the same approach as Erlang. Python in particular has several great ways to get the benefits
by techdragon 11y ago
You can "magically" gain a lot of the things Erlang has, by using the same approach as Erlang.
Python in particular has several great ways to get the benefits of shared nothing, "green thread"/"VM internal processes"/Erlang style concurrency, powered by message passing.
My two favourite ones are.
Stackless Python - it's got a mixed reputation among the subset of Python programmers that know it exists, but if you're curious about Erlang style concurrency, it's at least worth reading about.
The Pulsar framework- https://pythonhosted.org/pulsar/ https://pythonhosted.org/pulsar/ - it's a Python 3.4/3.5 asyncio powered Erlang style actor model concurrency framework... It's brilliant and deserves much more attention than it gets.
- rdtsc 11y ago> to get the benefits of shared nothing, "green thread"/"VM internal processes" ... Stackless Python It is shared everything isn't it. Greenlet is core which was extracted out of stackless and both gevent and eventlet are based on it. Can get lightweight concurrency units sure. That's very far from Erlang. To put it another way a thread (even a green one) + a thread safe queue does not an Erlang make ;-) But is a popular trope usually, when frameworks claim "we do Erlang" it often means that. Some of the things Erlang has can be found in various languages and frameworks. The best approximation is actually -- an operating system. OS processes are closest to how Erlang works. They are isolated from each other. Can have systemd or other things supervise them. Can send messages via pipes, unix sockets, files etc. But can't have 1M of those running. Then like you mentioned can have green threads in other languages. But can't have low latency GC, CPU scaling, isolated memory for each concurrency unit. So not quite there. > The Pulsar framework- https://pythonhosted.org/pulsar/ https://pythonhosted.org/pulsar/ That does look pretty cool. I'll have to take a look. Thanks for the link!
- BuckRogers 11y agoCan you tell me why it's brilliant? I've looked it over and as far as I can tell there's nothing new here. It's main claim to fame is that it's built on asyncio / requires Python3 which makes it dead in the water for my PyPy projects.