skbase.utils.is_flat#

skbase.utils.is_flat(obj)[source]#

Check whether iterable or sequence is flat.

If any elements are iterables or sequences the object is considered to not be flat.

Parameters:
objAny

The object to check to see if it is flat (does not have nested iterable).

Returns:
bool

Whether or not the input obj contains nested iterables.

Examples

>>> from skbase.utils import is_flat
>>> is_flat([1, 2, 3, 4, 5])
True
>>> is_flat([1, (2, 3), 4, 5])
False