Revision 2de64672 lib/utils.py
b/lib/utils.py | ||
---|---|---|
1477 | 1477 |
return False |
1478 | 1478 |
|
1479 | 1479 |
|
1480 |
def partition(seq, pred=bool): # # pylint: disable-msg=W0622 |
|
1481 |
"Partition a list in two, based on the given predicate" |
|
1482 |
return (list(itertools.ifilter(pred, seq)), |
|
1483 |
list(itertools.ifilterfalse(pred, seq))) |
|
1484 |
|
|
1485 |
|
|
1480 | 1486 |
def UniqueSequence(seq): |
1481 | 1487 |
"""Returns a list with unique elements. |
1482 | 1488 |
|
Also available in: Unified diff