I am new to programming and have been working with Python for several months now. I am trying to get a concept for working with Stackless, but I just can't figure out how (although I wrote other test scripts that work with Stackless).
Anywho, as the example examined, will consider the following code that goes through the list and finds all permutations (edit: n-dimensional Cartesian products), calling the same function recursively.
def traverseList(theList,temp,solutions,level=1):
if level != len(theList):
for x in theList:
temp.append(x)
traverseList(theList,temp,solutions,level+1)
temp.pop()
else:
for x in theList:
temp.append(x)
solutions.append(temp[:])
temp.pop()
myList = ["a",None,2,"gamma",8]
solutionList = []
tempList = []
traverseList(myList,tempList,solutionList)
print("%s... %s" %(solutionList[0], solutionList[-1]))
which gives:
['a', 'a', 'a', 'a', 'a']... [8, 8, 8, 8, 8]
It still seems that the only examples that I find in Stackless and recursion have a function to send information at the end of a function after it is completed. Never in the middle of a for loop, as would be necessary in the above.
? script, , ? ( - , , , . , .)
e-cookie , bounceBack - .
!