| 1 | initial version |
This is from the Sage reference manual:
sage: X = Set([1,2,3])
sage: list(X.subsets(2))
[{1, 2}, {1, 3}, {2, 3}]
Or using pure Python tools:
sage: X = set([1,2,3])
sage: import itertools
sage: itertools.combinations(k, 2)
<itertools.combinations object at 0x4572cf470>
sage: list(itertools.combinations(k, 2))
[(1, 2), (1, 3), (2, 3)]
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.