Hi, I am getting the following errorTypeError: sort() takes no keyword arguments

Peter Otten __peter__ at web.de
Fri Oct 17 03:46:49 EDT 2008


gaurav kashyap wrote:

> Hi all,
> I am using python version 2.3.in a program ,
> I have called the sort function.Wherein,
> a.sort(reverse=True)
> is giving the following error:
> 
> TypeError: sort() takes no keyword arguments.
> 
> It works in python 2.4,What can be the alternative in python 2.3

a.reverse()
a.sort()
a.reverse()

gives the same result. If you don't care about the order of equal items

a.sort()
a.reverse()

will do.

Peter



More information about the Python-list mailing list