Commit 96c4de96 authored by Georg Brandl's avatar Georg Brandl

Closes #22868: make example less ambiguous.

parent 01bd3c12
......@@ -181,12 +181,12 @@ There are three built-in functions that are very useful when used with lists:
the sequence for which ``function(item)`` is true. If *sequence* is a
:class:`string` or :class:`tuple`, the result will be of the same type;
otherwise, it is always a :class:`list`. For example, to compute a sequence of
numbers not divisible by 2 or 3::
numbers divisible by 2 or 3::
>>> def f(x): return x % 2 != 0 and x % 3 != 0
>>> def f(x): return x % 3 == 0 or x % 5 == 0
...
>>> filter(f, range(2, 25))
[5, 7, 11, 13, 17, 19, 23]
[3, 5, 6, 9, 10, 12, 15, 18, 20, 21, 24]
``map(function, sequence)`` calls ``function(item)`` for each of the sequence's
items and returns a list of the return values. For example, to compute some
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment