Invert a predicate function. There is a homonymous function in the toolz package () but significantly modified.
The function to complement.
The complement to func.
complement is equivalent to
lambda x: not x()but significantly faster:
>>> from iteration_utilities import complement >>> from iteration_utilities import is_None >>> is_not_None = complement(is_None) >>> list(filter(is_not_None, [1,2,None,3,4,None])) [1, 2, 3, 4]
(callable) The function that is complemented (readonly).
New in version 0.6.