Q:

Logical Base Case

I've got this very simple recursive function:
def subL(L):
    x=len(L)
    if x==0:
        return L
    else:
        print(L[:x]) 
        subL(L[:x-1])

This is example input I've used:
x = [23,2,5,77,8,9]
print(subL(x))

This is the output:
[23, 2, 5, 77, 8, 9]
[23, 2, 5, 77, 8]
[23, 2, 5, 77]
[23, 2, 5]
[23, 2]
[23]
None

How does the base case of this function work if x==0: return L ? Is that the reason I am getting None in the output? 
Can it be amended to simple produce: the following?
[23, 2, 5, 77, 8, 9]
[23, 2, 5, 77, 8]
[23, 2, 5, 77]
[23, 2, 5]
[23, 2]
[23]

A:

It is because you are not returning the result of the recursive function. Change the recursive line to this
return subL(L[:x-1])

And if you want to ignore the last None alone, invoke the function without print, like this
subL(x)

If you don't explicitly return anything, Python will return None by default. That's why you see that None being printed.
The entire program can be shortened like this
def subL(L):
    if L:
        print(L)
        return subL(L[:-1])

