recursive function return value problems
randomtalk at gmail.com
randomtalk at gmail.com
Wed Dec 28 18:25:30 EST 2005
hi, i have the following recursive function (simplified to demonstrate
the problem):
>>> def reTest(bool):
... result = []
... if not bool:
... reTest(True)
... else:
... print "YAHHH"
... result = ["should be the only thing returned"]
... print "printing result: "
... print result
... return result
...
>>> reTest(False)
YAHHH
printing result:
['should be the only thing returned']
printing result:
[]
[]
I don't understand why results are returned twice? is there something
special i missed about recursive functions?
More information about the Python-list
mailing list