ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 13 Jun 2011 10:04:26 -0500Using @parallel in creating a listhttp://ask.sagemath.org/question/8163/using-parallel-in-creating-a-list/The question is how to create a list one element at a time using a parallel defined function. I do NOT want to use list comprehension like `[f(i) for i in [1..100]]` with a parallel defined `f`. I want to create a list that will still exist in Sage even if I interrupt its calculation before it's done.
It doesn't matter what my function is here. The point is what I'm trying to do here.
sage: @parallel(2)
....: def GMP(n): return (n,GetMinPerimAndSequence(n))
....:
sage: L = []
sage: L.append(GMP([1..100]))
What I intended was that I wanted to run this command with parallel execution, but create a list that would exist **even if I interrupt the calculation** (such as if it takes a looong time).
sage: L
[<generator object __call__ at 0x4964050>]
sage: L[0]
<generator object __call__ at 0x4964050>
which of course is the same as just making a generator in the first place and using it. So this strategy doesn't work.kcrismanMon, 13 Jun 2011 10:04:26 -0500http://ask.sagemath.org/question/8163/