# ipartition¶

iteration_utilities.ipartition(iterable, pred)

Use a predicate to partition entries into False entries and True entries.

Parameters: iterable : iterable Iterable to partition. pred : callable The predicate which determines the group in which the value of the iterable belongs. false_values : generator An iterable containing the values for which the predicate was False. true_values : generator An iterable containing the values for which the predicate was True.

Examples

>>> from iteration_utilities import ipartition
>>> def is_odd(val): return val % 2
>>> [list(i) for i in ipartition(range(10), is_odd)]
[[0, 2, 4, 6, 8], [1, 3, 5, 7, 9]]