Lichen

Change of lib/__builtins__/list.py

356:8327049267bf
lib/__builtins__/list.py
     1.1 --- a/lib/__builtins__/list.py	Fri Dec 09 16:26:50 2016 +0100
     1.2 +++ b/lib/__builtins__/list.py	Fri Dec 09 17:27:30 2016 +0100
     1.3 @@ -21,7 +21,8 @@
     1.4  
     1.5  from __builtins__.iterator import itemiterator
     1.6  from __builtins__.sequence import sequence
     1.7 -import native
     1.8 +from native import list_append, list_concat, list_element, list_init, \
     1.9 +                   list_len, list_nonempty, list_setelement
    1.10  
    1.11  class list(sequence):
    1.12  
    1.13 @@ -34,7 +35,7 @@
    1.14          # Reserve an attribute for a fragment reference along with some space
    1.15          # for elements.
    1.16  
    1.17 -        self.__data__ = native.list_init(args is not None and len(args) or 0)
    1.18 +        self.__data__ = list_init(args is not None and len(args) or 0)
    1.19  
    1.20          if args is not None:
    1.21              self.extend(args)
    1.22 @@ -47,7 +48,7 @@
    1.23  
    1.24          "Append 'value' to the list."
    1.25  
    1.26 -        native.list_append(self, value)
    1.27 +        list_append(self, value)
    1.28  
    1.29      def insert(self, i, value): pass
    1.30  
    1.31 @@ -66,7 +67,7 @@
    1.32  
    1.33          "Return the length of the list."
    1.34  
    1.35 -        return native.list_len(self.__data__)
    1.36 +        return list_len(self.__data__)
    1.37  
    1.38      def __add__(self, other): pass
    1.39  
    1.40 @@ -75,7 +76,7 @@
    1.41          "Concatenate 'other' to the list."
    1.42  
    1.43          if isinstance(other, list):
    1.44 -            native.list_concat(self, other.__data__)
    1.45 +            list_concat(self, other.__data__)
    1.46          else:
    1.47              self.extend(other)
    1.48          return self
    1.49 @@ -92,7 +93,7 @@
    1.50  
    1.51          "Lists are true if non-empty."
    1.52  
    1.53 -        return native.list_nonempty(self.__data__)
    1.54 +        return list_nonempty(self.__data__)
    1.55  
    1.56      def __iter__(self):
    1.57  
    1.58 @@ -107,13 +108,13 @@
    1.59          "Return the item at the normalised (positive) 'index'."
    1.60  
    1.61          self._check_index(index)
    1.62 -        return native.list_element(self.__data__, index)
    1.63 +        return list_element(self.__data__, index)
    1.64  
    1.65      def __set_single_item__(self, index, value):
    1.66  
    1.67          "Set at the normalised (positive) 'index' the given 'value'."
    1.68  
    1.69          self._check_index(index)
    1.70 -        return native.list_setelement(self.__data__, index, value)
    1.71 +        return list_setelement(self.__data__, index, value)
    1.72  
    1.73  # vim: tabstop=4 expandtab shiftwidth=4