[Python-ideas] fork

Sven R. Kunze srkunze at mail.de
Wed Jul 29 18:46:22 CEST 2015


Hi everybody,

well during the discussion of the concurrency capabilities of Python, I 
found this article reading worthwhile: 
http://chriskiehl.com/article/parallelism-in-one-line/ His statement 
"Mmm.. Smell those Java roots." basically sums the whole topic up for me.


That is sequential code (almost plain English):

for image in images:
     create_thumbnail(image)


In order to have a start with parallelism and concurrency, we need to do 
the following:

pool = Pool()
pool.map(create_thumbnail, images)
pool.close()
pool.join()


Not bad (considering the other approaches), but why couldn't it not look 
just like the sequential one, maybe like this:

for image in images:
     fork create_thumbnail(image)


What I like about the Pool concept is that it frees me of thinking about 
the interprocess/-thread communication and processes/threads management 
(not sure how this works with coroutines, but the experts of you do know).

What I would like to be freed of as well is: pool management. It 
actually reminds me of languages without garbage-collection.


Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150729/7c90573f/attachment.html>


More information about the Python-ideas mailing list