pysal.lib.weights.comb

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

Combinations of size n taken from items

Parameters:
items : list

items to be drawn from

n : integer

size of combinations to take from items

Returns:
implicit : generator

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]