Defining functions error?
I've got some code I've been using to test stuff... and I know python/sage doesn't have explicit function ends (it is white-space determined) but I can't for the life of me figure out what is going on with this code:
#A dummy parallel function to count elements in a generator/iterator. @parallel(6) def dummy_look(grpit): cntrdmy=0 looptre=True while looptre: try: grpit.next() cntrdmy+=1 except StopIteration: looptre = False return cntrdmy #print 1 def myfirstn(n): num = 0 while num<n: yield num num += 1 return (any executable line)
When I leave "print 1" commented out, it raises an error on the 2nd definition.
When I uncomment "print 1" it excecutes just fine. (and correctly runs the parallel-ness, though that isn't demonstrated in this code)
I'm running this on cloud.sagemath.com