title: Have the class as value in a dictionary
body: <p>I have a class:</p>
  <pre><code>class Competition:
  
      def __init__(self, year = int, distance = int, stages = int, winner = None , cyclist = list):
          self.year = year
          self.distance = distance
          self.stages = stages
          self.winner = winner
          self.cyclist = cyclist
  
  
      def __str__(self):
          return &quot;Competition({}, {}, {}, {}, {}&quot;.format(self.year, self.distance, self.stages, self.winner, self.cyclist)
  
      def __repr__(self):
          return &quot;{} {} {} {} {}&quot;.format(self.year, self.distance, self.stages, self.winner, self.cyclist)
  </code></pre>
  <p>And I want to add the class to a dictionary as the value, and as key the years.
  The information I get is from a file.</p>
  <p>So I have this</p>
  <pre><code> with open('tour-de-france.csv') as file:
      reader = csv.reader(file)
      no_header = next(reader, None)
  
      new_dict = {}
      for x in reader:
          new_dict[int(x[0])] = Competition(int(x[0]), x[3], x[11], None,[])
      print(new_dict)
  </code></pre>
  <p>Part of the output is:</p>
  <pre><code>{1903: 1903 2428 6 None [], 1904: 1904 2428 6 None [], 1905: 1905 2994 11 None [],
  </code></pre>
  <p>But I would like it as:</p>
  <pre><code>{1903: Competition(1903, 2428, 6, None, []), 1904: Competition(1904, 2428, 6, None, []), 1905: Competition(1905, 2994, 11, None, []),
  </code></pre>
  <p>Is that possible?</p>