]> granicus.if.org Git - python/commitdiff
Use 'predicate = bool' as the default predicate for ifilter[false].
authorGuido van Rossum <guido@python.org>
Mon, 20 Oct 2003 17:01:07 +0000 (17:01 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 20 Oct 2003 17:01:07 +0000 (17:01 +0000)
Doc/lib/libitertools.tex

index 30d80c183fa89f1a756f85240ffeb8910b60c105..aec55cb4e9b63297e7826203d9cfad4b54ace8d5 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