1.1 --- a/lib/__builtins__/str.py Mon Dec 12 01:46:28 2016 +0100
1.2 +++ b/lib/__builtins__/str.py Mon Dec 12 17:05:59 2016 +0100
1.3 @@ -22,6 +22,7 @@
1.4 from __builtins__.int import maxint, minint
1.5 from __builtins__.operator import _negate
1.6 from __builtins__.sequence import itemaccess
1.7 +from __builtins__.types import check_int
1.8 from native import str_add, str_lt, str_gt, str_eq, str_len, str_nonempty, \
1.9 str_substr
1.10
1.11 @@ -189,7 +190,26 @@
1.12 "Return the item at the normalised (positive) 'index'."
1.13
1.14 self._check_index(index)
1.15 - return str_substr(self.__data__, index, 1)
1.16 + return str_substr(self.__data__, index, index + 1, 1)
1.17 +
1.18 + def __get_multiple_items__(self, start, end, step):
1.19 +
1.20 + """
1.21 + Return items from 'start' until (but excluding) 'end', at 'step'
1.22 + intervals.
1.23 + """
1.24 +
1.25 + self._check_index(start)
1.26 + self._check_end_index(end)
1.27 + check_int(step)
1.28 +
1.29 + if step == 0:
1.30 + raise ValueError(step)
1.31 +
1.32 + if start == end:
1.33 + return ""
1.34 +
1.35 + return str_substr(self.__data__, start, end, step)
1.36
1.37 class string(basestring):
1.38 pass