def quick_sort(array): """ Returns a sorted 'array' by quick sort algorithm via list comprehension, here 'array' is actually a list. """ if len(array) <= 1: return array else: pivot = array[0] left = quick_sort([x for x in array[1:] if x < pivot]) right = quick_sort([x for x in array[1:] if x >= pivot]) return left + [pivot] + right