> can anybody point out a situation where you really need 
> itertools.filterfalse() ?
Sometimes you get the predicate as a parameter to another function. This way if 
you want to filter out things you can easily do it. Other language (such as 
Clojure) have a "complement" function that removes the need of filterfalse.

For example (Python 3):
    def percent_spam(is_spam, documents):
        n_spam = sum(1 for _ in filter(is_spam, documents))
        n_ham = sum(1 for _ in filterfalse(is_spam, documents))
        return float(n_spam) / (n_ham + n_spam)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to