sorting a tuple

Simon Brunning SBrunning at trisystems.co.uk
Wed Nov 15 03:57:54 EST 2000


> From:	June Kim [SMTP:junaftnoon at nospamplzyahoo.com]
> 
> tuple=(100,4,59,1000,82)
> tosort= list(tuple)
> tosort.sort(lambda x,y:-cmp(x,y))
> 
> p.s. You could reverse the list with the built-in reverse() instead of
> using
> customized sort.
 
AFAIK, a standard sort followed by a reverse would be *much* faster - see
the sorting mini-HOWTO at
<http://www.python.org/doc/howto/sorting/node2.html>.

Cheers,
Simon Brunning
TriSystems Ltd.
sbrunning at trisystems.co.uk
Consistency requires you to be as ignorant today as you were a year ago. -
Bernard Berenson




-----------------------------------------------------------------------
The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorised. If you are not the intended recipient, any disclosure,
copying, distribution, or any action taken or omitted to be taken in
reliance on it, is prohibited and may be unlawful. TriSystems Ltd. cannot
accept liability for statements made which are clearly the senders own.




More information about the Python-list mailing list