In Python2 I could use
def subsets(mySet):
return reduce(lambda z, x: z + [y + [x] for y in z], mySet, [[]])
to find all subsets of mySet
. Python 3 has removed reduce
.
What would be an equally concise rewrite of this for Python3?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…