10000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 90fc1db commit 260e935Copy full SHA for 260e935
spatialmath/smuserlist.py
@@ -245,7 +245,16 @@ def __getitem__(self, i):
245
"""
246
247
if isinstance(i, slice):
248
- return self.__class__([self.data[k] for k in range(i.start or 0, i.stop or len(self), i.step or 1)])
+ if i.stop is None:
249
+ # stop not given
250
+ end = len(self)
251
+ elif i.stop < 0:
252
+ # stop is negative, -
253
+ end = i.stop + len(self) + 1
254
+ else:
255
+ # stop is positive, use it directly
256
+ end = i.stop
257
+ return self.__class__([self.data[k] for k in range(i.start or 0, end, i.step or 1)])
258
else:
259
return self.__class__(self.data[i])
260
0 commit comments