Skip to content

Commit 19d8782

Browse files
RF: directly check ndim
Refactoring of the `ndim` check and updating the comment Co-Authored-By: Chris Markiewicz <[email protected]>
1 parent 1e41afc commit 19d8782

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

nibabel/fileslice.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def is_fancy(sliceobj):
4848
if not isinstance(sliceobj, tuple):
4949
sliceobj = (sliceobj,)
5050
for slicer in sliceobj:
51-
if hasattr(slicer, 'dtype') and slicer.ndim > 0: # ndarray always fancy
51+
if getattr(slicer, 'ndim', 0) > 0: # ndarray always fancy, but scalars are safe
5252
return True
5353
# slice or Ellipsis or None OK for basic
5454
if isinstance(slicer, slice) or slicer in (None, Ellipsis):

0 commit comments

Comments
 (0)