capturegraph.data.containers.utilities.where
#
where - Partition List Elements by Predicate#
Partition a List into two Lists based on a predicate function.
Example
where(data, predicate)
#
Partition elements by a predicate function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
List[T]
|
The List to partition. |
required |
predicate
|
Callable[[T], bool]
|
A callable that returns True/False for each element. |
required |
Returns:
| Type | Description |
|---|---|
tuple[List[T], List[T]]
|
Tuple of (matching, not_matching) Lists. |