Filter
suggest changeSyntax
Parameters
function| callable that determines the condition orNonethen use the identity function for filtering (positional-only)iterable| iterable that will be filtered (positional-only)
Remarks
In most cases a comprehension or generator expression is more readable, more powerful, and more efficient than filter(). In Python 3, filter returns an iterator. The Python 2 name ifilter is gone; the complementary iterator is itertools.filterfalse.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents