On Oct 14, 8:45 pm, Cameron Simpson <c...@zip.com.au> wrote: > On 14Oct2010 20:11, Steve Howell <showel...@yahoo.com> wrote: > | Is there a way to extract code out of a generator function f() into > | g() and be able to have f() yield g()'s result without this idiom?: > | > | for g_result in g(): > | yield g_result > | > | It feels like a clumsy hindrance to refactoring, to have to introduce > | a local variable and a loop. > > This sounds like the "yield from" proposal that had discussion some > months ago. Your above idiom would become: > > yield from g() > > See PEP 380: > http://www.python.org/dev/peps/pep-0380/ > Short answer, not available yet. >
Very interesting, thanks. -- http://mail.python.org/mailman/listinfo/python-list