Popular recipes by George V. Reilly http://code.activestate.com/recipes/users/4161272/2012-02-04T04:23:01-08:00ActiveState Code RecipesSorting a dict's items and keys (Python) 2012-02-04T04:23:01-08:00George V. Reillyhttp://code.activestate.com/recipes/users/4161272/http://code.activestate.com/recipes/578031-sorting-a-dicts-items-and-keys/ <p style="color: grey"> Python recipe 578031 by <a href="/recipes/users/4161272/">George V. Reilly</a> (<a href="/recipes/tags/dictionary/">dictionary</a>, <a href="/recipes/tags/sorting/">sorting</a>). </p> <p><a href="https://github.com/collective/icalendar">icalendar</a> uses its own CaselessDict as the base of many classes. I needed to produce the keys and items in a canonical order, so that certain keys would appear first.</p>