Language Enhancement Idea to help with multi-processing (your opinions please)

Carl Banks pavlovevidence at gmail.com
Fri Oct 14 02:56:20 EDT 2011


On Thursday, October 13, 2011 7:16:37 PM UTC-7, Steven D'Aprano wrote:
> > 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.
> 
> Why do you think this needs to be a language statement?
> 
> You can have that functionality *right now*, without waiting for a syntax
> update, by use of the multiprocessing module, or a third party module.
> 
> http://docs.python.org/library/multiprocessing.html
> http://wiki.python.org/moin/ParallelProcessing
> 
> There's no need for forcing language changes on everyone, whether they need
> it or not, for features that can easily be implemented as library code.

This goes a little beyond a simple threading mechanism, though.  It's more like guidance to the compiler that you don't care what order these are executed in; the compiler is then free to take advantage of this advice however it like.  That could be to spawn threads, but it could also compile instructions to optimize pipelining and cacheing.  The compiler could also ignore it.  But you can see that, fully realized, syntax like that can do much more than can be done with library code.

Obviously that extra capability is a very long way off for being useful in CPython.


Carl Banks



More information about the Python-list mailing list