Skip to content

Commit 38f5aaa

Browse files
Add suggestion to TypeError on __iter__.
1 parent 607d7d5 commit 38f5aaa

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/netCDF4/_netCDF4.pyx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2570,7 +2570,9 @@ strings.
25702570
raise IndexError('%s not found in %s' % (lastname,group.path))
25712571

25722572
def __iter__(self):
2573-
raise TypeError("Dataset is not iterable.")
2573+
raise TypeError(
2574+
"Dataset is not iterable. Consider iterating on Dataset.variables."
2575+
)
25742576

25752577
def __contains__(self, key):
25762578
raise TypeError(
@@ -4050,7 +4052,7 @@ behavior is similar to Fortran or Matlab, but different than numpy.
40504052
If fill_value is set to `False`, then the variable is not pre-filled.
40514053
The default netCDF fill values can be found in the dictionary `netCDF4.default_fillvals`.
40524054
If not set, the default fill value will be used but no `_FillValue` attribute will be created
4053-
(this is the default behavior of the netcdf-c library). If you want to use the
4055+
(this is the default behavior of the netcdf-c library). If you want to use the
40544056
default fill value, but have the `_FillValue` attribute set, use
40554057
`fill_value='default'` (note - this only works for primitive data types). `Variable.get_fill_value`
40564058
can be used to retrieve the fill value, even if the `_FillValue` attribute is not set.

0 commit comments

Comments
 (0)