Commit 0c9a318d authored by Guido van Rossum's avatar Guido van Rossum

Use 'predicate = bool' as the default predicate for ifilter[false].

parent f0dfc7ac
......@@ -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
......
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