cfdm.Data.__iter__¶
-
Data.
__iter__
()[source]¶ Called when an iterator is required.
x.__iter__() <==> iter(x)
Examples
>>> d = cfdm.Data([1, 2, 3], 'metres') >>> for e in d: ... print(repr(e)) ... 1 2 3
>>> d = cfdm.Data([[1, 2], [4, 5]], 'metres') >>> for e in d: ... print(repr(e)) ... <Data(2): [1, 2] metres> <Data(2): [4, 5] metres>
>>> d = cfdm.Data(34, 'metres') >>> for e in d: ... print(repr(e)) Traceback (most recent call last): ... TypeError: Iteration over 0-d Data