On 03May2010 22:02, rickhg12hs <rickhg1...@gmail.com> 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 <c...@zip.com.au> 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

Reply via email to