need help on generator...

Laszlo Zsolt Nagy gandalf at geochemsource.com
Fri Jan 21 09:22:48 EST 2005


Joh wrote:

>hello,
>
>i'm trying to understand how i could build following consecutive sets
>from a root one using generator :
>
>l = [1,2,3,4]
>
>would like to produce :
>
>[1,2], [2,3], [3,4], [1,2,3], [2,3,4] 
>  
>
Do you mean:

[1,2], [2,3], [3,4], [1,2,3], [2,3,4], [1,3,4]


(E.g. all elements in the power set except the empty set, the sets with 
one element and the sets with all elements.)
Otherwise, please describe your desired sets in verbal - I cannot see 
the point.




More information about the Python-list mailing list