> You didn't have to switch to a while loop here. The simplest fix for > your for loop is this: > > �...@inlinecallbacks > def gotConnection(conn): > for lineEvent in conn: > line = yield lineEvent > print line
Yes, I did that too. I wanted the loop to be able to terminate without user intervention on a signalisation message: this is handy with for when it is only a matter of raising StopIteration. In our two examples, the user will have to be prepared for Exception to stop the loop. Thank you, > > But aside from that... > > No, you must have the `yield` somewhere in the function. If you want > something less scrutable than this, then you probably want something > like corotwine. > > Jean-Paul > > _______________________________________________ > Twisted-Python mailing list > [email protected] > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python > _______________________________________________ Twisted-Python mailing list [email protected] http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
