I define the intersection of two lists as follows:
def intersect(a, b): return list(set(a) & set(b))
For three arguments, it will look like this:
def intersect(a, b, c): return (list(set(a) & set(b) & set(c))
Can I generalize this function to a variable number of lists?
The call will look like this:
>> intersect([1, 2, 2], [2, 3, 2], [2, 5, 2], [2, 7, 2]) [2]
EDIT: Can Python achieve this only this way?
intersect([ [1, 2, 2], [2, 3, 2], [2, 5, 2], [2, 7, 2] ]) [2]