Parallelization in Python 2.6

Neal Becker ndbecker2 at gmail.com
Wed Aug 19 09:41:58 EDT 2009


sturlamolden wrote:

> On 18 Aug, 11:41, Stefan Behnel <stefan... at behnel.de> wrote:
> 
>> I think the canonical answer is to use the threading module or
>> (preferably) the multiprocessing module, which is new in Py2.6.
>>
>> 
http://docs.python.org/library/threading.htmlhttp://docs.python.org/library/multiprocessing.html
>>
>> Both share a (mostly) common interface and are simple enough to use. They
>> are pretty close to the above interface already.
> 
> There is a big difference between them, which is that multiprocessing
> do not work with closures. This means that the threading module is
> simpler to use than multiprocessing if you want to parallelize serial
> code. You just wrap a closure around whatever block of code you want
> to run in a thread.

Do you have an example of this technique?





More information about the Python-list mailing list