1.1 --- a/lib/__builtins__/span.py Thu Mar 09 23:19:43 2017 +0100
1.2 +++ b/lib/__builtins__/span.py Fri Mar 10 15:20:52 2017 +0100
1.3 @@ -90,7 +90,7 @@
1.4 "Initialise the iterator with the given 'obj'."
1.5
1.6 self.start = obj.start
1.7 - self.end = obj.end
1.8 + self.count = obj.__len__()
1.9 self.step = obj.step
1.10 self.current = obj.start
1.11
1.12 @@ -98,11 +98,12 @@
1.13
1.14 "Return the next item or raise a StopIteration exception."
1.15
1.16 - if self.step < 0 and self.current <= self.end or self.step > 0 and self.current >= self.end:
1.17 + if not self.count:
1.18 raise StopIteration
1.19
1.20 current = self.current
1.21 self.current += self.step
1.22 + self.count -= 1
1.23 return current
1.24
1.25 def range(start_or_end, end=None, step=1):