Jan. 21, 2014
4:36 a.m.
On Tue, Jan 21, 2014 at 07:46:12PM +1300, Greg Ewing wrote:
Jonathan Slenders wrote:
@coroutine def a(): return (yield from b())
You could write it as:
def a(): return b()
I'm guessing you mean
def a(): return from b()
but that wouldn't be a coroutine, because it doesn't contain a 'yield' anywhere.
If b() is a generator/iterator then the second example removes the frame associated fom a() from the stack while you iterate: for x in a(): # one less frame on the stack at this point Oscar