python equivalent of Comparable
<p>Ok,</p>

<p>So here's my situation. I have a dictionary of the following form:</p>

<pre><code>{ &lt;Category('Simulate', 'False', 'False', 'False', 'INTERMEDIATE')&gt;: {'link': u'/story/4/tvb-adapters-simulator-simulatorAdapter/SimulatorAdapter', 'name': u'Simulate'}, 
  &lt;Category('View Results', 'True', 'False', 'True', 'INTERMEDIATE')&gt;: {'link': '/story/step/3', 'name': u'View Results'}, 
  &lt;Category('Analyze', 'True', 'False', 'False', 'FINAL')&gt;: {'link': '/story/step/2', 'name': u'Analyze'}}
</code></pre>

<p>Category is a class representing an instance from a database. Now I have the following instance:</p>

<pre><code>    &lt;Category('Analyze', 'True', 'False', 'False', 'FINAL')&gt;
</code></pre>

<p>Now this is not the same instance. By this I mean, I get all the values from the database and create the dictionary. Then after a while I get an id and retrieve the instance from the database. Now they are not the same objects. I now have to check if it's in the dictionary, but:</p>

<pre><code>instance in disctionary
</code></pre>

<p>Will return false. Now I could go the ugly way and iterate over the dictionary checking if all the values match, however does Python have a more clever way to do this? I mean something like the equivalent of Comparable in Java?</p>

<p>Regards,
Bogdan</p>
