itertools.filterfalse - what is it good for

Wolfgang Maier wolfgang.maier at biologie.uni-freiburg.de
Fri Mar 8 11:45:03 EST 2013


Dear all,
can anybody point out a situation where you really need itertools.filterfalse() ?
So far, I couldn't think of a case where you couldn't replace it with a
generator expression/if combination.
e.g.,

a=filterfalse(lambda x: x%2, range(1,101))
b=(i for i in range(1,101) if not i % 2)

do not return the same object type, but otherwise are achieving the same thing.
What am I missing here? For sure filterfalse exists for a reason?

Best,
Wolfgang




More information about the Python-list mailing list