Skip to main content

filter

No overview available.

def filter(
function: callable,
iterable: iterable
) - > iterator

Filters a sequence of elements by applying a predicate function to each item and retaining only those that evaluate to true.

Parameters

NameTypeDescription
functioncallableA function that accepts an item and returns a boolean; if null, the identity function is used.
iterableiterableThe sequence of elements to be filtered.

Returns

TypeDescription
iteratorAn iterator yielding the items from the original sequence for which the function returned true.