skbase.utils.unflat_len#
- skbase.utils.unflat_len(obj)[source]#
Return number of elements in nested iterable or sequence structure.
Determines the total number of elements in a nested iterable/sequence structure. Input that is not a iterable or sequence is considered to have length 1.
- Parameters:
- objAny
Object to determine the unflat length.
- Returns:
- int
The unflat length of the input.
Examples
>>> from skbase.utils import unflat_len >>> unflat_len(7) 1 >>> unflat_len((1, 2)) 2 >>> unflat_len([1, (2, 3), 4, 5]) 5