I would like to select only those sets from a list of sets that are subsets of another set, so essentially that:
sets = [{1, 2, 3}, {6, 7, 8}]
s = {1, 2, 3, 4, 5, 6, 7}
list(compress(sets, [sub <= s for sub in sets]))
This works but it feels wrong to first evaluate the list comprehension and afterwards using compress. Is there a way to index sets directly, like:
sets[[sub <= s for sub in sets]] ### This does not work!