<br><br><div class="gmail_quote">On Sat, Mar 15, 2008 at 12:44 PM, Neville Grech Neville Grech &lt;<a href="mailto:nevillegrech@gmail.com">nevillegrech@gmail.com</a>&gt; 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&#39;re out of luck. Your code below doesn&#39;t work (the &#39;yield *it&#39; 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&#39;re really much better off explicitly defining the behaviour (by looping yourself.)<br>
&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>&gt;&gt;&gt; def coroutine():<br>...&nbsp;&nbsp;&nbsp;&nbsp; a, b = (yield *[1,2])<br>...&nbsp;&nbsp;&nbsp; print (a)<br>
...&nbsp;&nbsp;&nbsp; print (b)<br>...<br>&gt;&gt;&gt; cr=coroutine()<br>&gt;&gt;&gt; next(cr)<br>1<br>&gt;&gt;&gt; cr.send(3)<br>
2<br>&gt;&gt;&gt; cr.send(4)<br>3<br>4<br>&gt;&gt;&gt;<br><br><br><div class="gmail_quote"><div><div></div><div class="Wj3C7c">On Sat, Mar 15, 2008 at 7:21 PM, Nick Coghlan &lt;<a href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.com</a>&gt; 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>
&gt; 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&#39;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 &nbsp; | &nbsp; <a href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.com</a> &nbsp; | &nbsp; Brisbane, Australia<br>
---------------------------------------------------------------<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <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 &lt;<a href="mailto:thomas@python.org">thomas@python.org</a>&gt;<br><br>Hi! I&#39;m a .signature virus! copy me into your .signature file to help me spread!