pycon logo

PyCon 2011 Atlanta

March 9th–17th

Log in or Sign Up

Prototyping Go's Select with for Stackless Python

log in to bookmark this presentaton

Experienced / Talk
March 12th 1:35 p.m. – 2:05 p.m.
Showing how to use Python to prototype powerful concurrency features for Stackless Python. We do want you to try this at home.


Google’s introduction of the Go language raised eyebrows in the Stackless Python community. Although very different languages, Go and Stackless Python’s concurrency model share a common ancestor: the Bell Labs family of languages (i.e., Newsqueak, Limbo). The common feature are channels: a synchronous message passing mechanism based on Tony Hoare’s Communicating Sequential Processes (CSP).

Both Go and Python have channels. However with the select language statement, Go has the ability to wait on multiple channels simultaneously. Select greatly simplifies many concurrent programming problems. Stackless Python does not have this feature. Other channel based languages also feature powerful concurrency constructs. How hard would these constructs be to implement for Stackless Python?

This talk explores the prototyping potential of, the PyPy's framework's implementation of Stackless Python. The beauty of is that it is written in Python and implements much of Stackless Python's API! The "case study" involves prototyping Go's select in before reimplementing select in C based Stackless Python.

During this talk, it will be shown how can be used with CPython and the greenlet package (no need to install another Python). The audience will also get an in depth look at how channels are implemented. Channels are at the heart of Stackless Python's message based concurrency model. Finally the audience will gain insights into future directions of Stackless Python.