homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients billje, eric.smith, mark.dickinson
Date 2012年04月11日.12:28:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1334147336.74.0.0574888372172.issue14542@psf.upfronthosting.co.za>
In-reply-to
Content
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".
History
Date User Action Args
2012年04月11日 12:28:56mark.dickinsonsetrecipients: + mark.dickinson, eric.smith, billje
2012年04月11日 12:28:56mark.dickinsonsetmessageid: <1334147336.74.0.0574888372172.issue14542@psf.upfronthosting.co.za>
2012年04月11日 12:28:56mark.dickinsonlinkissue14542 messages
2012年04月11日 12:28:56mark.dickinsoncreate

AltStyle によって変換されたページ (->オリジナル) /