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 Tomas Dabašinskas
Recipients Tomas Dabašinskas
Date 2017-03-08.05:32:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1488951172.21.0.568731538203.issue29754@psf.upfronthosting.co.za>
In-reply-to
Content
sorted ignores reverse=True when sorting produces same list, I was expecting reverse regardless of the sorting outcome.

Python 3.5.2 (default, Jul 17 2016, 00:00:00) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> data = [{'name': 'first', 'weight': 1},{'name': 'second', 'weight': 1},{'name': 'third', 'weight': 1}, {'name': 'fourth', 'weight': 1}]
>>> sorted(data, key=lambda x: x['weight'], reverse=True)
[{'name': 'first', 'weight': 1}, {'name': 'second', 'weight': 1}, {'name': 'third', 'weight': 1}, {'name': 'fourth', 'weight': 1}]
>>> sorted(data, key=lambda x: x['weight'], reverse=True) == sorted(data, key=lambda x: x['weight']).reverse()
False

Thanks!
History
Date User Action Args
2017-03-08 05:32:52Tomas Dabašinskassetrecipients: + Tomas Dabašinskas
2017-03-08 05:32:52Tomas Dabašinskassetmessageid: <1488951172.21.0.568731538203.issue29754@psf.upfronthosting.co.za>
2017-03-08 05:32:52Tomas Dabašinskaslinkissue29754 messages
2017-03-08 05:32:51Tomas Dabašinskascreate