On Sat, Mar 15, 2008 at 12:44 PM, Neville Grech Neville Grech < [EMAIL PROTECTED]> wrote:
> What about co-routines? > 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.) > > >>> def coroutine(): > ... a, b = (yield *[1,2]) > ... print (a) > ... print (b) > ... > >>> cr=coroutine() > >>> next(cr) > 1 > >>> cr.send(3) > 2 > >>> cr.send(4) > 3 > 4 > >>> > > > On Sat, Mar 15, 2008 at 7:21 PM, Nick Coghlan <[EMAIL PROTECTED]> wrote: > > > Guido van Rossum wrote: > > > What do people think? > > > > I think this idea (or variants thereof) has been suggested a few times > > over the years, and I don't think the arguments against it have ever > > been particularly compelling. The difference this time is that PEP 3132 > > has done the work of thrashing out some of the semantic details, and > > Thomas has provided an actual working patch to make it happen :) > > > > So +1 here, even though I expect style guides will end up discouraging > > some of the more obscure possible uses. > > > > Cheers, > > Nick. > > > > -- > > Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia > > --------------------------------------------------------------- > > http://www.boredomandlaziness.org > > _______________________________________________ > > Python-3000 mailing list > > [email protected] > > http://mail.python.org/mailman/listinfo/python-3000 > > Unsubscribe: > > http://mail.python.org/mailman/options/python-3000/nevillegrech%40gmail.com > > > > > > -- > Regards, > Neville Grech > _______________________________________________ > Python-3000 mailing list > [email protected] > http://mail.python.org/mailman/listinfo/python-3000 > Unsubscribe: > http://mail.python.org/mailman/options/python-3000/thomas%40python.org > > -- Thomas Wouters <[EMAIL PROTECTED]> Hi! I'm a .signature virus! copy me into your .signature file to help me spread!
_______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
