Benjamin Peterson added the comment:
5 and 12 both appear twice in the list, so as far as the key function is
concerned, they're equal.
--
nosy: +benjamin.peterson
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python trac
New submission from Tamirys Pino :
>>> data=[2, 3, 2, 4, 5, 12, 2, 3, 3, 3, 12, 5]
>>> data
[2, 3, 2, 4, 5, 12, 2, 3, 3, 3, 12, 5]
>>> sorted(data)
[2, 2, 2, 3, 3, 3, 3, 4, 5, 5, 12, 12]
>>> sorted(data, key=data.count)
[4, 5, 12, 12, 5, 2, 2, 2, 3, 3, 3, 3]
[4, 5, 12, 12, 5, 2, 2, 2, 3, 3, 3,