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 |
Undocumented |
Function | union |
Union a collection of sets. |
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([]) []
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
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