python快速排序算法实现 'int' object is not iterable

#-*- coding:utf-8 -*-
import math
import random
import time
import sys

def quicksort(numbers):
#快速排序:
    if numbers==[]:
        return []
    else:
        forehalf=[]
        endhalf=[]
        for i in range(1,len(numbers)):
            if numbers[i]<numbers[0]:
                forehalf.append(numbers[i])
            else:
                endhalf.append(numbers[i])
        return quicksort(forehalf)+list(numbers[0])+quicksort(endhalf)

def main():
    sys.setrecursionlimit(100000)
    numbers=[]
    for i in range(100):
        numbers.append(int(round(random.random()*20000)))
    starttime=time.clock()
    a=quicksort(numbers)
    print a
    endtime=time.clock()
    print "排序历时:",endtime-starttime,"s"

if __name__=="__main__":
    main()

运行结果总是提示:quicksort函数最后一行错误,错误提示为:TypeError: 'int' object is not iterable
有人能帮忙看下是什么问题吗?多谢!(注:python版本-Python 2.7.10)

查看回复