Parameter Details function callable that determines the condition or None then use the identity function for filtering (positionalonly) iterable iterable that will be filtered (positional-only) Section 26.1: Basic use of filter
To filter discards elements of a sequence based on some criteria:
Filter as short-circuit check
filter (python 3.x) and ifilter (python 2.x) return a generator so they can be very handy when creating a shortcircuit test like or or and:
Complementary function: filterfalse, ifilterfalse