Skip to content

Commit

Permalink
Add suggestion to TypeError on __iter__.
Browse files Browse the repository at this point in the history
  • Loading branch information
RandallPittmanOrSt committed Nov 8, 2024
1 parent 607d7d5 commit 38f5aaa
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/netCDF4/_netCDF4.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2570,7 +2570,9 @@ strings.
raise IndexError('%s not found in %s' % (lastname,group.path))

def __iter__(self):
raise TypeError("Dataset is not iterable.")
raise TypeError(
"Dataset is not iterable. Consider iterating on Dataset.variables."
)

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

0 comments on commit 38f5aaa

Please sign in to comment.