1.1 --- a/lib/__builtins__/str.py Wed Jan 11 12:26:04 2017 +0100
1.2 +++ b/lib/__builtins__/str.py Wed Jan 11 17:22:32 2017 +0100
1.3 @@ -19,20 +19,16 @@
1.4 this program. If not, see <http://www.gnu.org/licenses/>.
1.5 """
1.6
1.7 -from __builtins__.int import maxint
1.8 from __builtins__.operator import _negate
1.9 -from __builtins__.sequence import itemaccess
1.10 +from __builtins__.sequence import hashable, itemaccess
1.11 from __builtins__.types import check_int
1.12 from native import str_add, str_lt, str_gt, str_eq, str_len, str_nonempty, \
1.13 str_substr
1.14
1.15 -class basestring(itemaccess):
1.16 +class basestring(hashable):
1.17
1.18 "The base class for all strings."
1.19
1.20 - _p = maxint / 32
1.21 - _a = 31
1.22 -
1.23 def __init__(self, other=None):
1.24
1.25 "Initialise the string, perhaps from 'other'."
1.26 @@ -62,15 +58,7 @@
1.27
1.28 "Return a value for hashing purposes."
1.29
1.30 - result = 0
1.31 - l = self.__len__()
1.32 - i = 0
1.33 -
1.34 - while i < l:
1.35 - result = (result * self._a + ord(self.__get_single_item__(i))) % self._p
1.36 - i += 1
1.37 -
1.38 - return result
1.39 + return self._hashvalue(ord)
1.40
1.41 def _binary_op(self, op, other):
1.42