On 12/19/2009 9:34 AM, mattia wrote: > Can you provide me a much pythonic solution (with comments if possible, > so I can actually learn something)? If you only need to get i'th element sometimes, sorting the dict is fine. Otherwise, you might want to use collections.OrderedDict.