New submission from Tomas Dabašinskas: 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! ---------- components: Library (Lib) messages: 289202 nosy: Tomas Dabašinskas priority: normal severity: normal status: open title: sorted ignores reverse=True when sorting produces same list versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29754> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com