returning none when it should be returning a list?
tzot at sil-tec.gr
Tue May 2 10:48:44 CEST 2006
On 1 May 2006 07:19:48 -0700, rumours say that randomtalk at gmail.com might
>I'm not sure what "falls off the end" of the function means, i searched
>online, it seems to mean that the function has reached the end
>prematurely and returned a default identifier to signal success or
>not.. Can you please explain what that means?
I think that you haven't grasped the fact that a chain of calls of a
recursive function needs a return for *every* invocation of the function
(but I could be wrong :)
Check the following function, analogous to your own:
>>> def f(x):
if x > 4:
print " returning", x
print " start recursion"
print " end recursion"
>>> print f(0)
Do you see why the function returns None?
TZOTZIOY, I speak England very best.
please stop spamming us."
More information about the Python-list