I have a dictionary like this:
{ <Category('Simulate', 'False', 'False', 'False', 'INTERMEDIATE')>: {'link': u'/story/4/tvb-adapters-simulator-simulatorAdapter/SimulatorAdapter', 'name': u'Simulate'}, <Category('View Results', 'True', 'False', 'True', 'INTERMEDIATE')>: {'link': '/story/step/3', 'name': u'View Results'}, <Category('Analyze', 'True', 'False', 'False', 'FINAL')>: {'link': '/story/step/2', 'name': u'Analyze'}}
A category is a class that represents an instance from a database. Now I have the following example:
<Category('Analyze', 'True', 'False', 'False', 'FINAL')>
Now this is not the same instance. By this I mean that I get all the values ββfrom the database and create a dictionary. Then after a while I get the identifier and retrieve the instance from the database. Now they are not the same objects. Now I have to check this in the dictionary, but:
instance in disctionary
Will return false. Now I could go in an ugly way and retry the dictionary check if all values ββmatch, however is there a smarter way for Python to do this? I mean something like the Comparable equivalent in Java?
source share