I also found an implementation of channels for Python called goless that relies on Stackless or gevent. The project's big open issue is that it's missing support for asyncio. That should be possible given asyncio has built-in support for synchronization primitives. But even with that, I'm not enthusiastic about how goless implements the select statement from Go:
chan = goless.chan() cases = [goless.rcase(chan), goless.scase(chan, 1), goless.dcase()] chosen, value = goless.select(cases) if chosen is cases[0]: print('Received %s' % value) elif chosen is cases[1]: assert value is None print('Sent.') else: assert chosen is cases[2] print('Default...')
An earlier attempt at select for Stackless has the same issue. Select is just really ugly. Send and receive on a channel aren't too pretty either. I wonder if there's a better way?