It follows the convention that methods that modify their object inplace should return None. list.pop() is an obvious exception.
You create a new list via list comprehension instead of copying and then removing:
even = [i for i in L if i % 2 == 0] # remove odd numbers
all = range() allbut2 = all allbut2.remove(2)
It follows the convention that methods that modify their object inplace should return None. list.pop() is an obvious exception.
You create a new list via list comprehension instead of copying and then removing: