title: Symmetric dictionary where d[a][b] == d[b][a]
body: <p>I have an algorithm in python which creates measures for pairs of values, where <code>m(v1, v2) == m(v2, v1)</code> (i.e. it is symmetric). I had the idea to write a dictionary of dictionaries where these values are stored in a memory-efficient way, so that they can easily be retrieved with keys in any order. I like to inherit from things, and ideally, I'd love to write a <code>symmetric_dict</code> where <code>s_d[v1][v2]</code> always equals <code>s_d[v2][v1]</code>, probably by checking which of the v's is larger according to some kind of ordering relation and then switching them around so that the smaller element one is always mentioned first. i.e. when calling <code>s_d[5][2] = 4</code>, the dict of dicts will turn them around so that they are in fact stored as <code>s_d[2][5] = 4</code>, and the same for retrieval of the data.
  I'm also very open for a better data structure, but I'd prefer an implementation with "is-a" relationship to something which just uses a dict and preprocesses some function arguments.</p>