Kenneth Love <[EMAIL PROTECTED]> writes: > In other words, I consider these two dictionaries to be equivalent: > > { 'dog' : 'bone', 'cat' : 'fever', 'mouse' : 'mickey' } > { 'mouse' : 'mickey', 'dog' : 'bone', 'cat' : 'fever' } > > while these two are not: > > { 'dog' : 'bone', 'cat' : 'fever', 'mouse' : 'mickey' } > { 'dog' : 'bone', 'cat' : 'fever', 'mouse' : 'michael' } > > Any suggestions on how to compare these via some assert statement?
Dictionaries already know how to compare themselves to each other. >>> {'dog': 'bone', 'cat': 'fever', 'mouse': 'mickey'} == {'mouse': 'mickey', 'dog': 'bone', 'cat': 'fever'} True >>> {'dog': 'bone', 'cat': 'fever', 'mouse': 'mickey'} == {'mouse': 'michael', 'dog': 'bone', 'cat': 'fever'} False -- \ "Many are stubborn in pursuit of the path they have chosen, few | `\ in pursuit of the goal." -- Friedrich Nietzsche | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list