[Python-Dev] Sort() returning sorted list

Guido van Rossum guido@python.org
Wed, 21 Aug 2002 01:26:17 -0400


> It would be nice to have, at times, sort() return the sorted list,
> but doing so could lead people to believe that returns a sorted copy of
> the list.  What about if we could do "list.sort(returnAfterSorting = 1)"
> or something?  It'd be nice if it were short and sweet, but it should
> be clear what it's doing too...

Nah, this is not provided precisely for the reason you give.  You can
write your own utility easily enough:

def sort(L):
    L.sort()
    return L

--Guido van Rossum (home page: http://www.python.org/~guido/)