<br><br><div class="gmail_quote">On Sat, Mar 15, 2008 at 12:44 PM, Neville Grech Neville Grech <<a href="mailto:nevillegrech@gmail.com">nevillegrech@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
What about co-routines?<br></blockquote><div><br>They're out of luck. Your code below doesn't work (the 'yield *it' syntax always results in None; any sends are discarded.) I do not think collecting a (potentially ever-growing) list of results is really the right thing to do, do you? :-) Something that *might* make sense is to forward any sends on to the inner iterator, but that means it would always have to be a generator, and at that point you're really much better off explicitly defining the behaviour (by looping yourself.)<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>>>> def coroutine():<br>... a, b = (yield *[1,2])<br>... print (a)<br>
... print (b)<br>...<br>>>> cr=coroutine()<br>>>> next(cr)<br>1<br>>>> cr.send(3)<br>
2<br>>>> cr.send(4)<br>3<br>4<br>>>><br><br><br><div class="gmail_quote"><div><div></div><div class="Wj3C7c">On Sat, Mar 15, 2008 at 7:21 PM, Nick Coghlan <<a href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.com</a>> wrote:<br>
</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="Wj3C7c">
<div>Guido van Rossum wrote:<br>
> What do people think?<br>
<br>
</div>I think this idea (or variants thereof) has been suggested a few times<br>
over the years, and I don't think the arguments against it have ever<br>
been particularly compelling. The difference this time is that PEP 3132<br>
has done the work of thrashing out some of the semantic details, and<br>
Thomas has provided an actual working patch to make it happen :)<br>
<br>
So +1 here, even though I expect style guides will end up discouraging<br>
some of the more obscure possible uses.<br>
<br>
Cheers,<br>
Nick.<br>
<font color="#888888"><br>
--<br>
Nick Coghlan | <a href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.com</a> | Brisbane, Australia<br>
---------------------------------------------------------------<br>
<a href="http://www.boredomandlaziness.org" target="_blank">http://www.boredomandlaziness.org</a><br>
</font></div></div><div><div></div><div><div><div></div><div class="Wj3C7c">_______________________________________________<br>
Python-3000 mailing list<br>
<a href="mailto:Python-3000@python.org" target="_blank">Python-3000@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-3000" target="_blank">http://mail.python.org/mailman/listinfo/python-3000</a><br></div></div>
Unsubscribe: <a href="http://mail.python.org/mailman/options/python-3000/nevillegrech%40gmail.com" target="_blank">http://mail.python.org/mailman/options/python-3000/nevillegrech%40gmail.com</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Regards,<br><font color="#888888">Neville Grech
</font><br>_______________________________________________<br>
Python-3000 mailing list<br>
<a href="mailto:Python-3000@python.org">Python-3000@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-3000" target="_blank">http://mail.python.org/mailman/listinfo/python-3000</a><br>
Unsubscribe: <a href="http://mail.python.org/mailman/options/python-3000/thomas%40python.org" target="_blank">http://mail.python.org/mailman/options/python-3000/thomas%40python.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Thomas Wouters <<a href="mailto:thomas@python.org">thomas@python.org</a>><br><br>Hi! I'm a .signature virus! copy me into your .signature file to help me spread!