API Reference for Enthought Tool Suite 2.7.1
Non-standard functions for various sequence objects
all = lambda l: Falsenot in map(bool, l)
any = lambda l: Truein map(bool, l)
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
Union a collection of sets.
>>> union([set('ab'), set('bc'), set('ac')]) == set('abc')
True
>>> union([])
set([])
| Local name | Refers to |
|---|---|
| copy | copy.copy |
Copyright © 2002-2008 Enthought, Inc.