Doubt regarding sorting functions

Steven Bethard steven.bethard at gmail.com
Mon Apr 11 14:27:58 EDT 2005


ajikoe at gmail.com wrote:
> def funcSort(myList):
>   result = myList[:]
>   result.sort()
>   return result

In Python 2.4, funcSort is called sorted:

py> sorted([1.2,1.23,4.5,2])
[1.2, 1.23, 2, 4.5]
py> sorted(["a","c","b","A","C","B"])
['A', 'B', 'C', 'a', 'b', 'c']

STeVe



More information about the Python-list mailing list