cf.Data.__iter__¶
-
Data.
__iter__
()[source]¶ Called when an iterator is required.
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], [4, 5]], 'metres') >>> for e in d: ... print(repr(e)) ... <CF Data: [1, 2] metres> <CF Data: [4, 5] metres>
>>> d = cf.Data(34, 'metres') >>> for e in d: ... print(repr(e)) .. TypeError: iteration over a 0-d Data