Skip to content

Commit

Permalink
a slice of an array of a given type is still of that same type
Browse files Browse the repository at this point in the history
  • Loading branch information
rhayes777 committed Dec 18, 2023
1 parent a1669cf commit 7cb6cc1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion autoarray/abstract_ndarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,10 @@ def reshape(self, *args, **kwargs):
return self._array.reshape(*args, **kwargs)

def __getitem__(self, item):
return self._array[item]
result = self._array[item]
if isinstance(item, slice):
return self.with_new_array(result)
return result

def __setitem__(self, key, value):
if isinstance(key, (np.ndarray, AbstractNDArray, Array)):
Expand Down

0 comments on commit 7cb6cc1

Please sign in to comment.