On 03May2010 22:02, rickhg12hs <[email protected]> wrote:
| Would a kind soul explain something basic to a python noob?
|
| Why doesn't this function always return a list?
|
| def recur_trace(x,y):
| print x,y
| if not x:
| return y
| recur_trace(x[1:], y + [x[0]])
You need:
return recur_trace(x[1:], y + [x[0]])
Otherwise the function returns None.
--
Cameron Simpson <[email protected]> DoD#743
http://www.cskk.ezoshosting.com/cs/
[...] every time you touch something, if your security systems rely
on biometric ID, then you're essentially leaving your pin number on a
post-it note. - Ben Goldacre, http://www.badscience.net//?p=585
--
http://mail.python.org/mailman/listinfo/python-list