1.1 --- a/lib/__builtins__/list.py Wed Oct 26 16:36:17 2016 +0200
1.2 +++ b/lib/__builtins__/list.py Thu Oct 27 17:55:28 2016 +0200
1.3 @@ -21,6 +21,7 @@
1.4
1.5 from __builtins__.iterator import listiterator
1.6 from __builtins__.sequence import _getitem, _getslice
1.7 +import native
1.8
1.9 class list(object):
1.10
1.11 @@ -33,9 +34,9 @@
1.12 if args is not None:
1.13 self.extend(args)
1.14
1.15 - def __new__(self):
1.16 # Reserve space for a fragment reference.
1.17 - self._elements = None
1.18 +
1.19 + self.__data__ = None
1.20
1.21 def __getitem__(self, index):
1.22
1.23 @@ -68,7 +69,13 @@
1.24 def pop(self): pass
1.25 def reverse(self): pass
1.26 def sort(self, cmp=None, key=None, reverse=0): pass
1.27 - def __len__(self): pass
1.28 +
1.29 + def __len__(self):
1.30 +
1.31 + "Return the length of the list."
1.32 +
1.33 + return native._list_len(self)
1.34 +
1.35 def __add__(self, other): pass
1.36 def __iadd__(self, other): pass
1.37 def __str__(self): pass
1.38 @@ -77,7 +84,7 @@
1.39
1.40 "Lists are true if non-empty."
1.41
1.42 - return self.__len__() != 0
1.43 + return native._list_nonempty(self)
1.44
1.45 def __iter__(self):
1.46
1.47 @@ -87,6 +94,10 @@
1.48
1.49 # Special implementation methods.
1.50
1.51 - def __get_single_item__(self, index): pass
1.52 + def __get_single_item__(self, index):
1.53 +
1.54 + "Return the item at 'index'."
1.55 +
1.56 + return native._list_element(self, index)
1.57
1.58 # vim: tabstop=4 expandtab shiftwidth=4