* Fix negative indices on spans

This commit is contained in:
Matthew Honnibal 2015-07-29 22:36:03 +02:00
parent 320836e346
commit d153f18969
1 changed files with 2 additions and 0 deletions

View File

@ -40,6 +40,8 @@ cdef class Span:
return self.end - self.start return self.end - self.start
def __getitem__(self, int i): def __getitem__(self, int i):
if i < 0:
i = len(self) - i
return self._seq[self.start + i] return self._seq[self.start + i]
def __iter__(self): def __iter__(self):