Recursive function not returning value
Derek Rhodes
rhoder at worldpath.net
Fri Sep 17 03:04:47 EDT 2004
using
Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on
win32
OK, I have a recursive function that should return a list, but doesn't
<start session>
def test(word):
if type(word) == str:
print "it's a word"
test([word])
if type(word) == list:
print "The conditional worked, see ->", word
return word
>>>a = test('foobity')
it's a word
The conditional worked, see -> ['foobity']
>>> print a
None
</end session>
What am I missing?
-derek.
More information about the Python-list
mailing list