[issue14542] reverse() doesn't reverse sort correctly
Bill Jefferson
report at bugs.python.org
Wed Apr 11 17:06:06 CEST 2012
Bill Jefferson <shaggers3 at yahoo.com> added the comment:
Mark and Eric......
Wonderful! I got it now. I used x.sort(reverse=True) and x.sort(reverse=False) and it works just fine. Thanks for your help.
Bill......
Regards from:
William Jefferson Photography
514 Daniels St., #211
Raleigh, NC 27605
Cell Phone: (919) 931-6681
EMail: shaggers3 at yahoo.com
Brides & Weddings: http://www.WilliamJeffersonPhotography.com
Special Events: http://www.DancingLight.org
________________________________
From: Mark Dickinson <report at bugs.python.org>
To: shaggers3 at yahoo.com
Sent: Wednesday, April 11, 2012 8:28 AM
Subject: [issue14542] reverse() doesn't reverse sort correctly
Mark Dickinson <dickinsm at gmail.com> added the comment:
Bill,
list.reverse doesn't do any *sorting* at all; it merely *reverses* the list contents.
[2, 4, 3, 1]
If you want to do a reverse sort, you can either first sort normally and then reverse the result, or (easier) use the 'reverse' keyword argument to the list.sort method, as follows:
[4, 3, 2, 1]
I suspect Eric meant to write "does not reverse sort" instead of "does not reverse".
----------
nosy: +mark.dickinson
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14542>
_______________________________________
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14542>
_______________________________________
More information about the Python-bugs-list
mailing list