title: add object into python's set collection and determine by object's attribute
body: <p>I have a <code>Person</code> class like this:</p>
  
  <pre><code>class Person:
      def __init__(self, name, age):
          self.name = name
          self.age = age
  
      def __repr__(self):
          return '&lt;Person {}&gt;'.format(self.name)
  </code></pre>
  
  <p>I want to add some instances of this class to a set, like this:</p>
  
  <pre><code>tom = Person('tom', 18)
  mary = Person('mary', 22)
  mary2 = Person('mary2', 22)
  
  person_set = {tom, mary, mary2}
  print(person_set)
  # output: {&lt;Person tom&gt;, &lt;Person mary&gt;, &lt;Person mary2&gt;}
  </code></pre>
  
  <p>As you can see, there are 2 Marys in the set. How can I make it so that <code>Person</code> instances with the same age are considered the same person, and only added to the set once?</p>
  
  <p>In other words, how can I get a result of <code>{&lt;Person tom&gt;, &lt;Person mary&gt;}</code>?</p>