A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-October/038756.html below:

[Python-Dev] decorate-sort-undecorate

[Python-Dev] decorate-sort-undecorate [Python-Dev] decorate-sort-undecorateGeoffrey Talvola gtalvola at nameconnector.com
Wed Oct 15 12:03:03 EDT 2003
Guido van Rossum wrote:
>> What about the situation where you want the list sorted in reverse
>> order? If you simply sort and then reverse the list you've broken
>> the stability. 
> 
> ...
> How important do you think this is?  We could punt on the issue,
> implement reverse by reverting the list afterwards.  (I could define
> stability differently and be totally happy with getting everything in
> reverse order rather than only the specified key. :-)

If you make that the documented behavior, then if someone really needs the
items sorted in reverse order, but stable with respect to the original list,
then this will work:

mylist.reverse()
mylist.sort(key=keyfunc, reverse=True)

- Geoff


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4