Top index Wirbel home

::intersection

list(A).intersection(acoll) - compute intersection of a list and another collection
set(A).intersection(acoll) - compute intersection of a set and another collection

list(A).intersection(acoll) returns a copy of alist with all elements removed that or not contained in acoll. acoll may be anything that supports the function set for converting it to a set. These are at least list, set and dict.

set(A).intersection(acoll) is a variant that operates on a set and returns a set rather than a list.