Il Sat, 19 Dec 2009 17:30:27 +1100, Lie Ryan ha scritto: > 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.
Well, in the python doc OrderedDict is described as a dict that remembers the order that keys were first inserted and I don't need this. The fact is that I use a structure composed by a date and a list of possible solutions found, like (2009/12/21, (('e', 12, 33), ('r', 4, 11), ('r', 1, 33))) then every solution is inserted concurrently in a dictionary. I want to sort the solution found to provide, e.g., the first 10 dates found and the best result of every date based on the i-th element of the date's list. -- http://mail.python.org/mailman/listinfo/python-list