title: TypeError: '<' not supported between instances - objects
body: <p>I am trying to sort by name but it is typing an Error: TypeError: '&lt;' not supported between instances of 'Person' and 'Person'. Could you tell me where the problem is? Here is my code. </p>
  
  <pre><code>class Person:
      def __init__(self, name, year_of_birth, degree):
          self.name = name
          self.year_of_birth = year_of_birth
          self.degree = degree
          self.mentor = None
          self.mentees = []
  
  def create_mentorship(mentor, mentee):
      mentee.mentor = mentor
      mentor.mentees.append(mentee)
  
  def get_founder(people):
      for person in people:
          if people[person].mentor == None:
              return people[person]
  
  def print_mentorship_tree(people):
      person = get_founder(people)
      print_mentorship_subtree(person)
  
  
  def print_mentorship_subtree(person, level=0):
      a = []
      print((" " * level) + person.name +' (' + str(person.year_of_birth) + ')')
      for mentee in person.mentees:
          print_mentorship_subtree(mentee, level + 1)
          a = sorted(person.mentees)
  
      &gt;&gt;&gt; people = {}
      &gt;&gt;&gt; people['Martin'] = Person('Martin', 1991, 'phd')
      &gt;&gt;&gt; people['Lukas'] = Person('Lukas', 1991, 'phd')
      &gt;&gt;&gt; people['Tom'] = Person('Tom', 1993, 'mgr')
      &gt;&gt;&gt; people['Honza'] = Person('Honza', 1995, 'bc')
      &gt;&gt;&gt; create_mentorship(people['Martin'], people['Tom'])
      &gt;&gt;&gt; create_mentorship(people['Tom'], people['Honza'])
      &gt;&gt;&gt; create_mentorship(people['Martin'], people['Lukas'])
      &gt;&gt;&gt; print_mentorship_tree(people)
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "so.py", line 38, in &lt;module&gt;
      print_mentorship_tree(people)
    File "so.py", line 20, in print_mentorship_tree
      print_mentorship_subtree(person)
    File "so.py", line 28, in print_mentorship_subtree
      a = sorted(person.mentees)
  TypeError: unorderable types: Person() &lt; Person()
  </code></pre>