This commit is contained in:
Miroslav Stampar
2016-09-23 12:45:06 +02:00
parent 1b48ff223d
commit b387fb219d
3 changed files with 9 additions and 3 deletions

View File

@@ -85,3 +85,9 @@ class xrange(object):
def _index(self, i):
return self.start + self.step * i
def index(self, i):
if self.start <= i < self.stop:
return i - self.start
else:
raise ValueError("%d is not in list" % i)