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

Ethan Furman ethan at stoneleaf.us
Fri May 1 03:02:01 CEST 2015


On 04/30, Yury Selivanov wrote:
> On 2015-04-30 8:35 PM, Steven D'Aprano wrote:

>> 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.

So, PEP 492 asynch for also guarantees that the loop runs in order, one at
a time, with one loop finishing before the next one starts?

*sigh*

How disappointing.

--
~Ethan~


More information about the Python-ideas mailing list