mirror of https://github.com/python/cpython
Remove duplicate recipe.
This commit is contained in:
parent
4585ca9428
commit
fd2405415b
|
@ -702,11 +702,6 @@ which incur interpreter overhead.
|
||||||
pending -= 1
|
pending -= 1
|
||||||
nexts = cycle(islice(nexts, pending))
|
nexts = cycle(islice(nexts, pending))
|
||||||
|
|
||||||
def powerset(iterable):
|
|
||||||
"powerset([1,2,3]) --> () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)"
|
|
||||||
s = list(iterable)
|
|
||||||
return chain.from_iterable(combinations(s, r) for r in range(len(s)+1))
|
|
||||||
|
|
||||||
def compress(data, selectors):
|
def compress(data, selectors):
|
||||||
"compress('ABCDEF', [1,0,1,0,1,1]) --> A C E F"
|
"compress('ABCDEF', [1,0,1,0,1,1]) --> A C E F"
|
||||||
return (d for d, s in izip(data, selectors) if s)
|
return (d for d, s in izip(data, selectors) if s)
|
||||||
|
|
Loading…
Reference in New Issue