Closed cjw85 closed 9 years ago
Huh. I had never thought to try out gridmap with a partial function before. Could you please add a test to tests/test_gridmap.py to verify that this works?
Sure, I'd started writing some, but got sidetracked.
The reason for wanting to use a partial is I have already a widely used utility function within my project that applies functools.partial and decorators to a function before handing off to either itertools.imap or multiprocessing.Pool.imap_unordered. I'd like a third option of handing off to gridmap, without forcing too much extra baggage on the caller.
Didn't realize you added the tests until now. Thanks, this looks great!
The checks in Job.function() stop partial objects being used. if m.name != "main": self._f = f
The proposed modification allows gridmap to work with a functools.partial object.