dict order

Robert Bossy Robert.Bossy at jouy.inra.fr
Wed Jun 18 14:10:38 CEST 2008

Lie wrote:
>> Whoops, I think I misunderstood the question. If what you're asking
>> whether two dictionary is equal (equality comparison, rather than
>> sorting comparison). You could do something like this:
Testing for equality and finding differences are trivial tasks indeed. 
It is the sort order I'm interested in. The meaning of the order is not 
really an issue, I'm rather looking for a consistent comparison function 
(in the __cmp__ sense) such as:
    if d1 > d2 and d2 > d3,
    then d1 > d3

I'm not sure the hashing method suggested by Albert guarantees that.


More information about the Python-list mailing list