]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport 1.19:
authorRaymond Hettinger <python@rcn.com>
Mon, 20 Oct 2003 20:45:33 +0000 (20:45 +0000)
committerRaymond Hettinger <python@rcn.com>
Mon, 20 Oct 2003 20:45:33 +0000 (20:45 +0000)
   Use 'predicate = bool' as the default predicate for ifilter[false].

Doc/lib/libitertools.tex

index dc1a77c39c8c2082f59c1dcfdb076ccb26c37e7b..596406f176de7300b64669f1bd93af18700000bf 100644 (file)
@@ -140,8 +140,7 @@ by functions or loops that truncate the stream.
   \begin{verbatim}
      def ifilter(predicate, iterable):
          if predicate is None:
-             def predicate(x):
-                 return x
+             predicate = bool
          for x in iterable:
              if predicate(x):
                  yield x
@@ -157,8 +156,7 @@ by functions or loops that truncate the stream.
   \begin{verbatim}
      def ifilterfalse(predicate, iterable):
          if predicate is None:
-             def predicate(x):
-                 return x
+             predicate = bool
          for x in iterable:
              if not predicate(x):
                  yield x