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
>> yield 3
>>
>>
>> t = T()
>
> im = new.instancemethod(T.foo, t, T)
>
>> prin
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
> yield 3
>
>
> t = T()
im = new.instancemethod(T.foo, t, T)
> print t.foo
> print im
# prints
# >
# >
>F
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