scamp_extensions.utilities.sequences.make_flat_list

scamp_extensions.utilities.sequences.make_flat_list(l: Sequence, indivisible: Optional[Union[Type, tuple[Type]]] = None) list[source]

Flattens a list, including ones containing multiple levels of nesting. Certain types can be excluded from expansion.

Parameters:
  • l – a list or similar iterable

  • indivisible – a type or tuple of types that should not be expanded out. E.g. a custom named tuple

Returns:

a flattened version of the list