Using non-hashable Python objects as keys in dictionaries
<p>Python doesn't allow non-hashable objects to be used as keys in other dictionaries. As pointed out by Andrey Vlasovskikh, there is a nice workaround for the special case of using non-nested dictionaries as keys:</p>

<pre><code>frozenset(a.items())#Can be put in the dictionary instead
</code></pre>

<p>Is there a method of using arbitrary objects as keys in dictionaries?</p>

<p><strong>Example</strong>:</p>

<p>How would this be used as a key?</p>

<pre><code>{"a":1, "b":{"c":10}}
</code></pre>

<p><strong>It is extremely rare that you will actually have to use something like this in your code. If you think this is the case, consider changing your data model first.</strong></p>

<p><strong>Exact use case</strong></p>

<p>The use case is caching calls to an arbitrary keyword only function. Each key in the dictionary is a string (the name of the argument) and the objects can be quite complicated, consisting of layered dictionaries, lists, tuples, ect.</p>

<p><strong>Related problems</strong></p>

<p>This sub-problem has been split off from <a href="http://stackoverflow.com/questions/1600591/using-a-python-dictionary-as-a-key">the problem here</a>. Solutions here deal with the case where the dictionaries is not layered.</p>
