[Python-checkins] cpython (2.7): Closes #22868: make example less ambiguous.

georg.brandl python-checkins at python.org
Fri Nov 14 11:13:16 CET 2014


https://hg.python.org/cpython/rev/5dd835edde1e
changeset:   93483:5dd835edde1e
branch:      2.7
user:        Georg Brandl <georg at python.org>
date:        Fri Nov 14 11:12:53 2014 +0100
summary:
  Closes #22868: make example less ambiguous.

files:
  Doc/tutorial/datastructures.rst |  6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)


diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst
--- a/Doc/tutorial/datastructures.rst
+++ b/Doc/tutorial/datastructures.rst
@@ -181,12 +181,12 @@
 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

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list