libpysal.weights.comb

libpysal.weights.comb(items, n=None)[source]

Combinations of size n taken from items

Parameters
itemslist

items to be drawn from

ninteger

size of combinations to take from items

Returns
implicitgenerator

combinations of size n taken from items

Examples

>>> x = range(4)
>>> for c in comb(x, 2):
...     print(c)
...
[0, 1]
[0, 2]
[0, 3]
[1, 2]
[1, 3]
[2, 3]