Skip to content

Commit 2d29dba

Browse files
committed
RF: Usually indexing is done with an indexing item.
If this is not implemented, this would throw the relatively cryptic: TypeError: __getitem__() takes 1 positional argument but 2 were given
1 parent 0507393 commit 2d29dba

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

nibabel/spatialimages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ def from_image(klass, img):
656656
klass.header_class.from_header(img.header),
657657
extra=img.extra.copy())
658658

659-
def __getitem__(self):
659+
def __getitem__(self, idx=None):
660660
''' No slicing or dictionary interface for images
661661
'''
662662
raise TypeError("Cannot slice image objects; consider slicing image "

0 commit comments

Comments
 (0)