This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients ezio.melotti, konryd, mark.dickinson, rhettinger
Date 2009-01-25.13:08:36
SpamBayes Score 5.0815148e-09
Marked as misclassified No
Message-id <1232888917.62.0.521655481338.issue5048@psf.upfronthosting.co.za>
In-reply-to
Content
> that dropping the length argument will make the function iterate over 
> *all* combinations,

Now *this* sounds more useful to me:  an itertool that generates *all* subsets of a list.  It's 
quite easy to do with existing itertools, though, either by looping over the second argument to 
combinations, or (for a different ordering) using product:

def subsets(iterable):
    l = list(iterable)
    for selector in itertools.product([False, True], repeat=len(l)):
        yield [element for indicator, element in zip(selector, l) if indicator]
History
Date User Action Args
2009-01-25 13:08:37mark.dickinsonsetrecipients: + mark.dickinson, rhettinger, ezio.melotti, konryd
2009-01-25 13:08:37mark.dickinsonsetmessageid: <1232888917.62.0.521655481338.issue5048@psf.upfronthosting.co.za>
2009-01-25 13:08:37mark.dickinsonlinkissue5048 messages
2009-01-25 13:08:36mark.dickinsoncreate