flatten

utils.flatten(data)[source]

Yields the elements in order from any N dimensional iterable

Parameters:data (iterable) –
Yields:ID ((string,list)) – A pair containing the value at each location and the co-ordinates used to access them.

Examples

>>> a = [[1, 2, 3],[4, 5, 6]]
>>> for i, loc in flatten(a): print(i,loc)
1 [0, 0]
2 [0, 1]
3 [0, 2]
4 [1, 0]
5 [1, 1]
6 [1, 2]