Dan Bishop schreef:
You can avoid the S list my making it a generator: def subsets(L): if L: for s in subsets(L[1:]): yield s yield s + [L[0]] else: yield []
Nice one. Thanks! Ozz -- http://mail.python.org/mailman/listinfo/python-list
Dan Bishop schreef:
You can avoid the S list my making it a generator: def subsets(L): if L: for s in subsets(L[1:]): yield s yield s + [L[0]] else: yield []
Nice one. Thanks! Ozz -- http://mail.python.org/mailman/listinfo/python-list