module documentation

Non-standard functions for various sequence objects

Function concat Concatenate a list of lists.
Function disjoint Test whether a collection of sets is pair-wise disjoint.
Function intersect Intersect a non-empty collection of sets.
Function is_sequence Undocumented
Function union Union a collection of sets.
def concat(lists): (source)

Concatenate a list of lists. >>> concat(range(i) for i in range(5)) [0, 0, 1, 0, 1, 2, 0, 1, 2, 3] >>> concat([[1,2], [3]]) [1, 2, 3] >>> concat([[1,2,[3,4]], [5,6]]) [1, 2, [3, 4], 5, 6] >>> concat([]) []

def disjoint(*sets): (source)

Test whether a collection of sets is pair-wise disjoint. >>> disjoint(set([1,2]), set([3])) True >>> disjoint(set('abc'), set('xy'), set('z'), set('cde')) False >>> disjoint() True

def intersect(sets): (source)

Intersect a non-empty collection of sets. >>> intersect([set('ab'), set('bc'), set('bb')]) set(['b']) >>> intersect([set('ab'), set('bc'), set('ac')]) set([]) >>> try: intersect([]) ... except: print('bad') ... bad

def is_sequence(x): (source)

Undocumented

def union(sets): (source)

Union a collection of sets. >>> union([set('ab'), set('bc'), set('ac')]) == set('abc') True >>> union([]) set([])