Is this a proper quicksort algorithm in Python?
Some comments:


Write docstrings to document code
Use if/else instead of if/elif if possible
Use list comprehensions
Use random.choice to get a random element from a non-empty sequence


The code in the original questions with the suggested improvements would be as follows:

import random

def qsort(qslist):
    """"Quicksort implementation."""
    if len(qslist) &lt; 2:
        return qslist

    pivot = random.choice(qslist)
    small = [x for x in qslist if x &lt; pivot]
    equal = [x for x in qslist if x == pivot]
    big = [x for x in qslist if x &gt; pivot]

    return qsort(small) + equal + qsort(big)

qslist = [9,1,8,2,7,3,6,4,5]
print(qsort(qslist))


Edit: If you prefer to avoid traversing the array three times, a partition
function to do that very similar to the one in the original question would be:

def partition(qslist):
    """Partition array using a pivot value."""
    small = []
    equal = []
    big = []

    pivot = random.choice(qslist)
    for x in qslist:
        if x &lt; pivot:
            small.append(x)
        elif x == pivot:
            equal.append(x)
        else:
            big.append(x)

    return small, equal, big