title: Python object with dictionary attribute being appended to with each loop iteration rather than being garbage collected
body: <p>I have created an Game class which has a dictionary attribute of players as an attribute, which should have ~36 players in it. </p>
  
  <p>I am iterating though a loop, creating a new instance of a Game object with each iteration and printing the contents of each player onto a csv file. </p>
  
  <p>However, with each iteration although a new object is created, it seems that the player attribute is being appended to rather than being garbage collected. </p>
  
  <pre><code>sheet = open('playerGames.csv', 'w+')
  gameNum = 2018020001
  
  while gameNum &lt; 2018020015:
  
      game = Game(gameNum)
  
      print(len(game.players), end=", ")
  
      for player in game.players:
          for stat in game.players[player]:
              sheet.write(str(game.players[player][stat]) + ",")
          sheet.write("\n")
      game = None
  
      gameNum = gameNum + 1
  </code></pre>
  
  <p>The print statement in the above should print a number about 36 each time however it outputs the following <code>36, 72, 108, 144, 163, 199, 217, 253, 289, 325, 361, 397, 433, 469</code></p>
  
  <p>Should the garbage collection not clear this up? I have added the <code>game = None</code> statement in hopes that the entire object gets collected, however that does not seem to work.</p>