[Python-ideas] More general "for" loop handling

Yury Selivanov yselivanov.ml at gmail.com
Fri May 1 02:54:42 CEST 2015


On 2015-04-30 8:35 PM, Steven D'Aprano wrote:
>> multiprocessing.Pool.map guarantees ordering.  It is
>> >multiprocessing.Pool.imap_unordered that doesn't.
> I don't think it guarantees ordering in the sense I'm referring to. It
> guarantees that the returned result will be [f(a), f(b), f(c), ...] in
> that order, but not that f(a) will be calculated before f(b), which is
> calculated before f(c), ... and so on. That's the point of parallelism:
> if f(a) takes a long time to complete, another worker may have completed
> f(b) in the meantime.

This is an *excellent* point.

Yury



More information about the Python-ideas mailing list