Adding a Par construct to Python?

CTO debatem1 at gmail.com
Thu May 28 15:21:24 EDT 2009


On May 28, 1:53 pm, Aaron Brady <castiro... at gmail.com> wrote:
> On May 27, 11:07 pm, Steven D'Aprano <st... at REMOVE-THIS-
>
> cybersource.com.au> wrote:
> > On Wed, 27 May 2009 12:58:02 +0000, Albert van der Horst wrote:
>
> > >>And how is reduce() supposed to know whether or not some arbitrary
> > >>function is commutative?
>
> > > Why would it or need it? A Python that understands the ``par'' keyword
> > > is supposed to know it can play some tricks with optimizing reduce() if
> > > the specific function is commutative.
>
> > Fine. Move the smarts out of reduce() into the compiler. How is the
> > compiler supposed to know if an arbitrary function is commutative?
>
> Unit testing.

I think this kind of gets to the heart of it, here- parallelization
is not a toy, runs with scissors, and will eat your dog, but so will
everything else if you don't know what you're doing. I just don't
see this as being a valid argument- maybe I'm wrong.

In the spirit of continuing to be wrong, would it be possible to
just fork off and synchronize the passed-in variables at the end
of the block via a container in shared memory? That sounds to me
like the simple, safe route, if a route must be taken.

Geremy Condra



More information about the Python-list mailing list