scamp_extensions.utilities.sequences

Subpackage containing utility functions for manipulating lists/sequences (some of which are imported from scamp.utilities).

Functions

cyclic_slice(l, start, end)

Takes a slice that loops back to the beginning if end is before start

multi_option_function(f)

Decorator that allows the first argument of the function to be a list, tuple, or iterator, and in that case performs the function one each element individually, returning a list, tuple, or iterator.

multi_option_method(f)

Same as multi_option_function(), but used to decorate methods instead of functions.

rotate_sequence(s, n)

Rotates a sequence s such that it begins with element l[n] and wraps back around to l[n-1].

sequence_depth(seq)

Find the maximum _depth of any element in a nested sequence.

make_flat_list(l[, indivisible])

Flattens a list, including ones containing multiple levels of nesting.

sum_nested_list(l)

Sums up all of the values within a nested list.