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 # <bound method T.foo of <__main__.T instance at 0x00B7ADA0>> # <bound method T.foo of <__main__.T instance at 0x00B7ADA0>> >From the output you can see that both are equivalent bound methods. > print 't.foo().next() = %s' % t.foo().next() > print 'im.next() = %s' % im.next() Yet you call t.foo() while you don't call im. Peter -- http://mail.python.org/mailman/listinfo/python-list