【发布时间】:2014-01-20 03:16:25
【问题描述】:
我正在尝试执行以下操作:
import functools
class TestClass():
def method(self, n):
for i in xrange(n):
yield i
# This works
for x in TestClass().method(10):
print x
# This gets a TypeError: functools.partial object not iterable
for x in functools.partial(TestClass().method, 10):
print x
那里有什么问题?
【问题讨论】:
标签: python generator functools