[Stackless] channels and StopIteration

Kristján Valur Jónsson kristjan at ccpgames.com
Wed Apr 11 15:49:50 CEST 2012


So,
Channels objey the iterator protocol.  calling channel.close() will raise the StopIteration exception from the channel.__next__ method.
But, calling channel.close() from the receiving end will also cause this same exception to be raised when someone wants to call channel.send().
Now, I wonder if a more appropriate exception for the send() call wouldn't be GeneratorExit()?    This is what the generator yield(foo) statement raises when the generator is closed, and it seems logical that this should be the exception raised when someone tries to send to a closed channel.

K
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20120411/26793624/attachment.html>


More information about the Stackless mailing list