1.1 --- a/lib/__builtins__/tuple.py Wed Nov 23 15:47:45 2016 +0100
1.2 +++ b/lib/__builtins__/tuple.py Wed Nov 23 15:48:37 2016 +0100
1.3 @@ -20,10 +20,10 @@
1.4 """
1.5
1.6 from __builtins__.iterator import listiterator
1.7 -from __builtins__.sequence import _getitem, _getslice
1.8 +from __builtins__.sequence import sequence
1.9 import native
1.10
1.11 -class tuple(object):
1.12 +class tuple(sequence):
1.13
1.14 "Implementation of tuple."
1.15
1.16 @@ -33,17 +33,11 @@
1.17
1.18 self.__data__ = native._tuple_init(args, len(args)) # allocate and copy elements
1.19
1.20 - def __getitem__(self, index):
1.21 -
1.22 - "Return the item or slice specified by 'index'."
1.23 -
1.24 - return _getitem(self, index)
1.25 -
1.26 def __getslice__(self, start, end=None):
1.27
1.28 "Return a slice starting from 'start', with the optional 'end'."
1.29
1.30 - return native._list_to_tuple(_getslice(self, start, end))
1.31 + return native._list_to_tuple(get_using(sequence.__getslice__, self)(start, end))
1.32
1.33 def __len__(self):
1.34
1.35 @@ -55,6 +49,8 @@
1.36
1.37 def __str__(self): pass
1.38
1.39 + __repr__ = __str__
1.40 +
1.41 def __bool__(self):
1.42
1.43 "Tuples are true if non-empty."