Re: Trouble with generator as method

2006-03-22 Thread Peter Cole
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

2006-03-22 Thread Peter Cole
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