cf.Data.__iter__

Data.__iter__()[source]

Efficient iteration

x.__iter__() <==> iter(x)

Examples

>>> d = cf.Data([1, 2, 3], 'metres')
>>> for e in d:
...    print repr(e)
...
1
2
3
>>> d = cf.Data([[1, 2, 3], [4, 5, 6]], 'metres')
>>> for e in d:
...    print repr(e)
...
<CF Data: [1, ..., 3] metres>
<CF Data: [4, ..., 6] metres>
>>> d = cf.Data(34, 'metres')
>>> for e in d:
...     print repr(e)
...
TypeError: Iteration over 0-d Data

Previous topic

cf.Data.__getitem__

Next topic

cf.Data.__setitem__

This Page