nobj = Name.lookup(self.name)
for k,v in Animal.animals_of.iteritems():
if k == nobj:
print 'found %s with %s' % ( nobj, k)
print v
print Animal.animals_of[nobj]
OUTPUT:
found abc with abc
[<Animal object at 0x7f9b00aa2290>]
print Animal.animals_of[nobj]
KeyError: <Name object at 0x7f9afe5824d0>
Question:
when i am iterating through Animal.animals_of, i can find nobj.
But when i am doing a lookup on nobj , it cant find it
Animal obj has its own __cmp__.
Does python dictionary use different compare method or something?