listsort
To sort a list in RPython, you can use the rpython.rlib.listsort module which provides a Timsort sorting algorithm. Timsort is a hybrid stable sorting algorithm, derived from merge sort and insertion sort, designed to perform well on many kinds of real-world data. Many programming languages’ standard libraries use Timsort to sort arrays of non-primitive type.
from rpython.rlib.listsort import TimSort
def listsort():
lst = [10, 1, 9, 2, 8, 3, 7, 4, 5, 6]
TimSort(lst).sort()
print lst
def entry_point(argv):
listsort()
return 0
def target(*args): return entry_point