I've got a list of Python objects that I'd like to sort by an attribute of the objects themselves. The list looks like:
>>> ut
[<Tag: 128>, <Tag: 2008>, <Tag: <>, <Tag: actionscript>, <Tag: addresses>,
<Tag: aes>, <Tag: ajax> ...]
Each object has a count:
>>> ut[1].count
1L
I need to sort the list by number of counts descending.
I've seen several methods for this, but I'm looking for best practice in Python.
Best Answer
More on sorting by keys.