I am new to recursion with Python and was trying to learn about linked-lists. The resource that I got the code below is http://www.openbookproject.net/thinkcs/python/english2e/ch18.html I was wondering why the return statement in line 2 doesn't need any arguments. I have tested that the code works by passing a linked-list to the function. Thank you!
def print_backward(list):
if list == None: return
head = list
tail = list.next
print_backward(tail)
print head,
returnwith no arguments is implicitlyreturn None. Also, thisreturnis not meant to return anything in the first place, it's just to break the recursion. That function does not return anything, but it prints.listas a name, it's a shadow name of python built-in function list.