hi Armin,
following the discussion we had today, that TransactionQueue could be
easier to understand for people if you explain it as "a for loop in which
you don't know the order of the iteration", I figured out that we might
even introduce some syntactic sugar for it; not sure if it makes things
simpler or more complicated, though :).
Anyway, I'm thinking of something like this:

def parallel(iterable):
    def decorator(f):
        tr = TransactionQueue()
        for item in iterable:
            tr.add(f, item)
        tr.run()
    return decorator


to be used in this way:

mylist = [1, 2, 3]

@parallel(mylist)
def for_(item):
    # do something with item
    pass


ciao,
Anto
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to