Mark Dickinson <dicki...@gmail.com> added the comment:

Bill,

list.reverse doesn't do any *sorting* at all;  it merely *reverses* the list 
contents.

>>> x = [1, 3, 4, 2]
>>> x.reverse()
>>> x
[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:

>>> x = [1, 3, 4, 2]
>>> x.sort(reverse=True)
>>> x
[4, 3, 2, 1]

I suspect Eric meant to write "does not reverse sort" instead of "does not 
reverse".

----------
nosy: +mark.dickinson

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14542>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to