Looking for a different version of sort

Dan Bishop danb_83 at yahoo.com
Wed Jun 16 04:10:16 EDT 2004


"Delaney, Timothy C (Timothy)" <tdelaney at avaya.com> wrote in message news:<mailman.31.1087353172.21521.python-list at python.org>...
...
> There is no function available which sorts in-place and returns a
> reference to the list sorted, but it's very simple to write a function
> to do it ...
> 
> def inplace sort (l):
>     l.sort()
>     return l

Or, alternatively:

sort = lambda l: (l.sort(), l)[1]



More information about the Python-list mailing list