title: Compare instances with __eq__ why doesn't work?
body: <p>I can't figure out why the function <code>createDeck</code> doesn't work.</p>
  
  <pre><code>class Card:
      def __init__(self):
          self.rank = tk.IntVar()
          self.rank.set(rm.choice(rank))
          self.seed = tk.StringVar()
          self.seed.set(rm.choice(seeds))
          self.point = tk.IntVar()
          self.point.set(self.calculatePoint())
          self.value = tk.StringVar()
          self.value.set(self.calculateValue())
          self.name = tk.StringVar()
          self.name.set(self.calculateName())
  
      def __str__(self):
          return self.name.get() + ' di ' + self.seed.get()
  
      def __lt__(self, other):
          return self.rank.get() &lt; other.rank.get()
  
      def __eq__(self, other):
          return self.__dict__ == other.__dict__
  
      def __ne__(self, other):
          return self.rank.get() != other.rank.get() and self.seed.get() != other.seed.get()
  
      def __gt__(self, other):
          return self.rank.get() &gt; other.rank.get()
  
  class Deck:
      def __init__(self):
          self.deck= []
          self.name = tk.Label(table, text='Deck', bd=3, relief='flat')
          self.name.grid(column=0, row=0)
  
      def createDeck(self):
          while len(self.deck) &lt; 40:
              x = Card()
              if x not in self.deck:
                  deck.append(x)
          table.create_text(500,200, text='deck is compose by %d cards' % (len(self.deck)))
  </code></pre>