Re: Trouble with generator as method
Peter Otten wrote: > Peter Cole wrote: > >> I'm having difficulty understanding why this doesn't work: > >> import sys, new, inspect >> >> class T: >> def foo(self): >> yield 1 >> yield 2 >>
Trouble with generator as method
I'm having difficulty understanding why this doesn't work: import sys, new, inspect class T: def foo(self): yield 1 yield 2 yield 3 t = T() ic = t.__class__ for key in ic.__dict__.keys(): if inspect.isfunction(ic.__dict__[key]): im = new.instancemetho