On 2009-05-17, Steven D'Aprano <st...@remove-this-cybersource.com.au> wrote: > On Sun, 17 May 2009 05:05:03 -0700, jeremy wrote: > >> From a user point of view I think that adding a 'par' construct to >> Python for parallel loops would add a lot of power and simplicity, e.g. >> >> par i in list: >> updatePartition(i) >> >> There would be no locking and it would be the programmer's >> responsibility to ensure that the loop was truly parallel and correct. > > What does 'par' actually do there?
My reading of the OP is that it tells the interpreter that it can execute any/all iterations of updatePartion(i) in parallel (or presumably serially in any order) rather than serially in a strict sequence. > Given that it is the programmer's responsibility to ensure > that updatePartition was actually parallelized, couldn't that > be written as: > > for i in list: > updatePartition(i) > > and save a keyword? No, because a "for" loop is defined to execute it's iterations serially in a specific order. OTOH, a "par" loop is required to execute once for each value, but those executions could happen in parallel or in any order. At least that's how I understood the OP. -- Grant -- http://mail.python.org/mailman/listinfo/python-list