My own accounting python euler problem

Ozz notvalid at wathever.com
Sun Nov 8 14:33:54 EST 2009


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



More information about the Python-list mailing list