pyfunctools.compact module
- pyfunctools.compact.compact(arr: list) list
Create a new list with only the truthy values from the original.
- Parameters:
arr (list) – original list
- Returns:
a list with truthy values
- Return type:
list
Examples
>>> compact([0, 1, 2, 3, '', None, False]) [1, 2, 3] >>> compact([0, '', None, False]) []