-
Notifications
You must be signed in to change notification settings - Fork 297
Closed
Description
At the moment, cubes report as being iterables, but raise an error if you try to iterate over a cube:
>>> isinstance(cube, Iterable)
True
>>> for c in cube:
... print c
TypeError: Cube is not iterableThis is confusing and potentially a bit awkward, as it looks like Iris can't make its mind up...
Of course this comes down to the presence of the __iter__ method, whose presence means the Cube class reports as being iterable, while the method itself just raises an error. We could:
- remove the
__iter__method, which is simple to do but unfortunately reverses the problem (Cube reports as not being iterable, while you actually can then iterate over a cube on its leading dimension) - explicitly support iterating by extending
__iter__, which is more complicated and potentially undefined - ... do something more clever than either of these suggestions
- just ignore it
rcomer
Metadata
Metadata
Assignees
Labels
No labels