[Stackless] Stackless API

Oren Tirosh oren at hishome.net
Mon Feb 2 19:49:58 CET 2004

On Mon, Feb 02, 2004 at 05:56:46PM +0100, Christian Tismer wrote:
> Oren Tirosh wrote:
> >On Thu, Jan 29, 2004 at 08:57:27PM +0100, Christian Tismer wrote:
> >...
> >
> >>As we are at it:
> >>What I *want* to take out is support for sending
> >>exceptions to channels.
> >
> >
> >There is one use case I found very useful: sending StopIteration into the
> >channel. I'm +1 on removing support for sending exceptions to channels
> >but only if there is some alternative mechanism to signal "end of data".
> >Perhaps channel.close() ?
> channel.close() is definately on my todo list.

If you just change "send" to "feed" and add the "close" method you get the 
consumer protocol:

If you change "receive" to "next" and add StopIteration (triggered by
close on the remote side) you get the iterator protocol:

This would make it possible to use channels in contexts that never heard 
of stackless and just use standard data source and data sink protocols. 

This, of course, raises other issues like compatibilty with existing code.


Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list