# HG changeset patch # User Paul Boddie # Date 1489155668 -3600 # Node ID ef0e0f95f50dd9378ff8c640a66378511117e151 # Parent 0ffb65419ef353e28e146cada0446c3b72d81a80# Parent a0c610ee056232776060d12e6f69f15ab5166e97 Merged changes from the default branch. diff -r 0ffb65419ef3 -r ef0e0f95f50d lib/__builtins__/span.py --- a/lib/__builtins__/span.py Thu Mar 09 23:20:23 2017 +0100 +++ b/lib/__builtins__/span.py Fri Mar 10 15:21:08 2017 +0100 @@ -90,7 +90,7 @@ "Initialise the iterator with the given 'obj'." self.start = obj.start - self.end = obj.end + self.count = obj.__len__() self.step = obj.step self.current = obj.start @@ -98,11 +98,12 @@ "Return the next item or raise a StopIteration exception." - if self.step < 0 and self.current <= self.end or self.step > 0 and self.current >= self.end: + if not self.count: raise StopIteration current = self.current self.current += self.step + self.count -= 1 return current def range(start_or_end, end=None, step=1):