A workaround for Python's missing frozen-dict type? : <p>In Python, when you want to use lists as keys of some dictionary, you can turn them into tuples, which are immutable and hence are hashable.</p>

<pre><code>&gt;&gt;&gt; a = {}
&gt;&gt;&gt; a[tuple(list_1)] = some_value
&gt;&gt;&gt; a[tuple(list_2)] = some_other_value
</code></pre>

<p>The same happens when you want to use <strong>set</strong> objects as keys of some dictionary - you can build a <strong>frozenset</strong>, that is again immutable and hence is hashable.</p>

<pre><code>&gt;&gt;&gt; a = {}
&gt;&gt;&gt; a[frozenset(set_1)] = some_value
&gt;&gt;&gt; a[frozenset(set_2)] = some_other_value
</code></pre>

<p>But it seems that for dictionary there is no equivalent.</p>

<p>A first idea I thought about (and found it bad finally), is to use <code>str(some_dict)</code> as a key. But, dictionaries always use different hash functions, so strings of equal dictionaries may be different.</p>

<p>Is there any workaround known as a good practice, or does anyone have other ideas how to use dictionary-like objects as keys of other dictionaries?</p>
