Martin P. Hellwig, 13.10.2011 14:35:
I was wondering if there could be an advantage to add another control flow statement.
Changes at that level must be very well justified, are often rejected for the reason of being not too complicated to write in some other form and are close to impossible to get accepted when requiring a new keyword.
Also, the right place to discuss (and, more importantly, search for previous) ideas about language changes is the python-ideas mailing list.
For the purpose of this writing let's say "ooo" which stands for 'out of order'. For example; def do_something(): a = 4 b = 2 c = 1 ooo: a += 1 b += 2 c += 3 print(a, b, c) What I would expect to happen that all statements within the ooo block may be executed out of order. The block itself waits till all statements are returned before continuing.
This looks like a rather special case. What if you need more than one statement to accomplish a single step? What if the number of parallel tasks is not fixed at coding time? I don't think there are many problems that you can solve with this feature.
Also: the GIL will not allow you to take a major advantage from the parallel execution of a set of statements, as only one of the statements can use the interpreter at a time.
And, on a related note: Cython has freshly gained support for parallel loops based on OpenMP, so you may be able to solve your problem with Cython instead of using plain Python.
Stefan -- http://mail.python.org/mailman/listinfo/python-list