can't use multiprocessing with class factory?

Hidura hidura at gmail.com
Fri Jan 28 14:34:35 EST 2011


What is the output?
2011年1月28日, Alan <alan.isaac at gmail.com>:
> Can the below example be fixed to work?
> Thanks,
> Alan Isaac
>> import multiprocessing as mp
>> class Test(object):
> pass
>> def class_factory(x):
> class ConcreteTest(Test):
> _x = x
> return ConcreteTest
>> def f(cls):
> print cls._x
>> if __name__ == '__main__':
> pool = mp.Pool(2)
> pool.map(f, [class_factory(i) for i in range(4)])
>> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
Enviado desde mi dispositivo móvil
Diego I. Hidalgo D.


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /