More ways to do it, from the FAQ http://www.python.org/doc/faq/programming.html#how-can-i-get-a-dictionary-to-display-its-keys-in-a-consistent-order Also look at the recipe, page 222 of Cookbook2, that allows you to rank key values by their associated values, and demonstrate the power of mixins.