[New-bugs-announce] [issue5228] multiprocessing not compatible with functools.partial

ndbecker report at bugs.python.org
Thu Feb 12 15:26:30 CET 2009


New submission from ndbecker <ndbecker2 at gmail.com>:

from multiprocessing import Pool

def power (x, pwr=2):
    return x**pwr

import functools
run_test = functools.partial (power, pwr=3)

if __name__ == "__main__":

    pool = Pool()
    cases = [3,4,5]
    results = pool.map (run_test, cases)

TypeError: type 'partial' takes at least one argument
Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/multiprocessing-2.6.1.1-py2.5-
    self.run()
  File "/usr/lib/python2.5/site-packages/multiprocessing-2.6.1.1-py2.5-
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python2.5/site-packages/multiprocessing-2.6.1.1-py2.5-
    task = get()
  File "/usr/lib/python2.5/site-packages/multiprocessing-2.6.1.1-py2.5-
    return recv()
TypeError: type 'partial' takes at least one argument

----------
components: Library (Lib)
messages: 81766
nosy: jnoller, ndbecker
severity: normal
status: open
title: multiprocessing not compatible with functools.partial
type: behavior
versions: Python 2.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5228>
_______________________________________


More information about the New-bugs-announce mailing list