Mark Dickinson <dicki...@gmail.com> added the comment: > 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] _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5048> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com