1.1 --- a/lib/__builtins__/sequence.py Sun Jan 29 22:56:43 2017 +0100
1.2 +++ b/lib/__builtins__/sequence.py Mon Jan 30 00:31:25 2017 +0100
1.3 @@ -36,22 +36,6 @@
1.4 if index < 0 or index >= self.__len__():
1.5 raise IndexError(index)
1.6
1.7 - def _confine_index(self, index):
1.8 -
1.9 - """
1.10 - Return the given absolute 'index', confined by the bounds of the
1.11 - sequence.
1.12 - """
1.13 -
1.14 - length = self.__len__()
1.15 -
1.16 - if index < 0:
1.17 - return 0
1.18 - elif index > length:
1.19 - return length
1.20 - else:
1.21 - return index
1.22 -
1.23 def __getitem__(self, index):
1.24
1.25 "Return the item or slice specified by 'index'."
1.26 @@ -153,9 +137,18 @@
1.27
1.28 def __get_multiple_items__(self, start, end, step):
1.29
1.30 - "Method to be overridden by subclasses."
1.31 + """
1.32 + Return items from 'start' until (but excluding) 'end', at 'step'
1.33 + intervals.
1.34 + """
1.35
1.36 - return None
1.37 + result = []
1.38 +
1.39 + while step > 0 and start < end or step < 0 and start > end:
1.40 + result.append(self.__get_single_item__(start))
1.41 + start += step
1.42 +
1.43 + return result
1.44
1.45 def __len__(self):
1.46
1.47 @@ -283,21 +276,6 @@
1.48
1.49 raise StopIteration()
1.50
1.51 - def __get_multiple_items__(self, start, end, step):
1.52 -
1.53 - """
1.54 - Return items from 'start' until (but excluding) 'end', at 'step'
1.55 - intervals.
1.56 - """
1.57 -
1.58 - result = []
1.59 -
1.60 - while step > 0 and start < end or step < 0 and start > end:
1.61 - result.append(self.__get_single_item__(start))
1.62 - start += step
1.63 -
1.64 - return result
1.65 -
1.66 def _get_absolute_index(index, length):
1.67
1.68 """