Adding a Par construct to Python?

Rhodri James rhodri at wildebst.demon.co.uk
Fri May 22 13:34:34 EDT 2009


On Fri, 22 May 2009 10:27:21 +0100, <jeremy at martinfamily.freeserve.co.uk>  
wrote:

> I think this depends on whether we think that Python is a language for
> people who we trust to know what they are doing (like Perl) or whether
> it is a language for people we don't trust to get things right(like
> Java). I suspect it probably lies somewhere in the middle.

So do I *in general*, but your design principle -- make it easy -- came
down firmly in the first camp and, as I said, I come down in the second
where parallel processing is concerned.  I've spent enough years weeding
bugs out of my insufficiently carefully designed Occam programs to have
the opinion that "easy" is the very last thing you want to make it.

> Actually the 'sync' command could lead to deadlock potentially:
>
> par i in range(2):
>     if i == 1:
>         sync

Hmm.  I was assuming you had some sort of implicit rendez-vous sync
at the end of the PAR.  Yes, this does make it very easy for the
freshly-enabled careless programmer to introduce deadlocks and
never realise it.

-- 
Rhodri James *-* Wildebeeste Herder to the Masses



More information about the Python-list mailing list