我有两个文件:
x.py
class BF(object)
def __init__():
.
.
def add(self,z):
.
.
y.py
from y import BF
def FUNC((a,b,bf))
.
.
bf.add(x)
.
.
return bf
.
.
if __name__ == '__main__':
pool = multiprocessing.Pool(3)
for i in range(len(sl)):
bf_set.append(BF())
results = pool.map(FUNC,zip(sl, itertools.repeat(aa), bf_set))
我也尝试在 FUNC 中定义 BF,但我得到了:
PicklingError: Can't pickle <type 'instancemethod'>: attribute lookup __builtin__.instancemethod failed
我已经阅读了一些有关相关问题的帖子,但是它们的 pool.map() 在类中,因此解决方案不能应用于这个问题(我猜)。
任何想法?