Re: extract method with generators

2010-10-14 Thread Steve Howell
On Oct 14, 8:45 pm, Cameron Simpson wrote: > On 14Oct2010 20:11, Steve Howell 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 fee

Re: extract method with generators

2010-10-14 Thread Cameron Simpson
On 14Oct2010 20:11, Steve Howell 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 intr

extract method with generators

2010-10-14 Thread Steve Howell
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. Here is a program t