iterables

File Purpose: tools for iterables

Functions

argmax(iterable)

returns first occurence of maximum value in iterable.

is_dictlike(x)

returns True if x is dict-like, False otherwise.

is_iterable(x)

returns True if x is iterable, False otherwise.

rargmax(iterable)

returns first occurence of maximum value in iterable, starting search from the end.

scalar_item(arraylike)

returns the single item from arraylike.

Classes

Bijection(*args, **kw)

stores forward and backward mapping.

BijectiveMemory(*args, **kw)

bijection which also stores the next key to use.

Container(stuff)

a container for multiple objects, & rules for enumerating & indexing.

ContainerOfArray(arr)

a numpy-array-like container.

ContainerOfDict(d)

a dict-like container.

ContainerOfList(objs)

a list-like container.

DictOfSimilar

dict of similar objects with similar attributes.

DictWithAliases(*args_dict[, aliases])

dict but some keys are aliases for other keys.

DictlikeFromKeysAndGetitem()

Dict-like object, assuming keys() and __getitem__ are defined.

Partition(original, f, *[, keys])

(ordered) dict of lists partitioned by category.

PartitionFromXarray(xarray[, coord, original])

(ordered) dict of lists partitioned by category.

SymmetricPairMapping([mapping])

mapping with keys pairs, where order of the pair doesn't matter.