Q:

Python: slice and remove in one step

I have a recursive Python function that removes one item from a copy of a list before passing the smaller list to the recursion:
B = A[:]
B.remove(C)
Recursion(B)

That works fine, but it seems more elegant to do:
Recursion(A[:].remove(C))

Unfortunately A[:].remove(C) yeilds None.  (Why?)  Is there an elegant way to do this in one line?

A:

Well, you could do the following using a list comprehension which creates a new list without the C element, that is assuming that there's only one C element in A - because remove() eliminates the first occurrence of the element, whereas the list comprehension removes all occurrences:
Recursion([x for x in A if x != C])

