dedalus.tools.general

Extended built-ins, etc.

Module Contents

class OrderedSet

Bases:collections.OrderedDict

Ordered set based on uniqueness of dictionary keys.

update(self, *args)
add(self, item)
rev_enumerate(sequence)

Simple reversed enumerate.

natural_sort(iterable, reverse=False)

Sort alphanumeric strings naturally, i.e. with “1” before “10”. Based on http://stackoverflow.com/a/4836734.

oscillate(iterable)

Oscillate forward and backward through an iterable.

unify(objects)

Check if all objects in a collection are equal. If so, return one of them. If not, raise.