Ian Bicking: the old part of his blog

Concurrency-Oriented Python

In Concurrency-oriented programming Peter Van Roy talks (briefly) about concurrency as a basis for functional programming. I like Python as a multi-paradigm language (sometimes procedural, sometimes OO, sometimes prototype-based, sometimes class... and on it goes). Can some of the techniques of Oz and Erlang also be implemented in Python? (In Stackless?)

I guess that means I'll have to learn Oz or Erlang before I'll know. (Which one?) There seems to be an emphasis on strict functional programming in both, such that the programmer is not only assisted in concurrent programming, but moreso they are forced to do clean concurrent programming. I/O always seems painful in a strictly functional environment, as it is very non-functional; computations are correct, not programs -- but functional and declarative programming tries to hide computation.

Anyway, a direction for further exploration...

Created 21 Oct '03
Modified 14 Dec '04

Comments:

Stackless is probably the thing you want to check out (speacking of checking out: the stackless website is really not
up to date anymore and the cvs address has changed to:
CVSROOT=:pserver:[email protected]/home/cvs
export CVSROOT
cvs login
cvs co stackless

What is possible now, is to have "tasklets" than run as light weight threads. Communication is done
via so called "channels". Tasklets can be pickled and saved for later use.

For now, it is not possible to use this in distributed computing environments, but there are definatelly
plans for that. At the moment, stackless is based on python 2.2.3 . Porting to python 2.3 might take a
while.
It might happen that stackless won't be continued as such, but integrated into the pypy (python in python).
See http://codespeak.net for further info on that.
# Stephan Diehl

I'm afraid that I haven't worked with Oz, so can't comment too much. I've done some workon Erlang, however, and would have to rate it as a good choice for certain types of application (it's great for state machines and protocol stacks - no great surprise given where it came from).

Erlang does have the advantage that it is a reasonably mature system - there are industrial scale telecomms and networking systems (mostly embedded) out there which use Erlang, and work very well.

It's worth remembering that Erlang grew out of Ericsson's need to try to streamline its won development and software QA issues, and so addresses particularly successfully some of the main preoccupations in telecomms networking: very high availability and reload of software on the fly.

On a personal note, I find that Erlang appeals to the same part of my brain which loves working in Python, although it is, of course, very different in look and feel...
# Jeremy O'Donoghue

You may also want to have a look at the Python-Logic SIG at http://www.logilab.org/projects/python-logic and at the new python-in-python interpreter that is in the works and will implement both stackless and psyco features, as well as many others (see http://codespeak.net/pypy).
# Nicolas