Hi again,

Stefan Behnel wrote:
>> with parallel(i):
>>    for i in xrange(n):x[i] = y[i]
> 
> Since we already have "with (no)gil", this would match nicely. Still, a syntax
> inside the loop header would be preferable to keep the link with the actual
> thing that runs in parallel, which is just the loop and nothing else inside
> the "with" block.

What about making it a completely different loop, BTW? I think the most
important use case is spawning threads for each item of a small data set, so a
full-fledged, potentially long-running for loop isn't required anyway. That
would allow a syntax like:

    with thread_each(iterable):
        # loop body

or

    with thread_range(1,5):
        # loop body

I mean, this isn't really about a sequential loop, it's more about doing
something with some things.

Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to