[New-bugs-announce] [issue12334] Strange sort error

Reinhard Engel report at bugs.python.org
Tue Jun 14 17:04:04 CEST 2011


New submission from Reinhard Engel <nc-engelre at netcologne.de>:

# Strange sort error
# lst1 and lst 2 produce different results, but should be same
# lst1 should sort by length of items, but doesn't, lst2 does!

lst0 = ['ab-get-ratings-max', 'ab-get-ratings-min', 'ab-rate-position', 'accum', 'add-cops', 'add-new-dice', 'add-passing-move', 'add-plants', 'add-two', 'add-widget']
print lst0
lst1 = sorted(lst0, lambda x, y: len(y) > len(x))
print lst1
lst2 = sorted(lst0, lambda x, y: len(y) - len(x))
print lst2

----------
messages: 138322
nosy: rengel
priority: normal
severity: normal
status: open
title: Strange sort error
type: behavior

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12334>
_______________________________________


More information about the New-bugs-announce mailing list