#!/usr/local/bin/python2
class C(object):
  def __init__(self, name):
    self.name = name

  def __eq__(self, o):
    if not isinstance(o, C):
      return NotImplemented
    return self.name == o.name

  def __hash__(self):
    return hash((self.__class__, self.name))

c = C(1)
c2 = C(1)
c3 = C(3)
d = {c: c, c3: c3, c2: c2}
print d