title: Using a dictionary (with changing values) as a flyweight in Python
body: <p>Suppose I create a dictionary</p>
  <p><code>d = {i:False for i in range(0,100)}</code></p>
  <p>Then I make a list</p>
  <p><code>l = [d[12], d[10], d[70]]</code></p>
  <p>and then change the dictionary:</p>
  <p><code>d[12] = True...</code></p>
  <p>the list doesn't change, is this behavior expected? If so, how can I add the values as references?</p>
  <p>I'm doing this in a more complicated context, but this is the first thing I wanted to investigate (of many potential issues, I just wrote this).</p>
  <p>Here's the full code:</p>
  <pre><code>import csv
  
  # create a bingo num flyweight --&gt; we don't have to update every board
  b = {i:False for i in range(0,100)}
  
  boards = []
  with open(&quot;04.csv&quot;) as f:
      reader = csv.reader(f)
      # get the numbers to be drawn
      draw = list(map(int, next(reader)))
      # skip the first emptyline before boards start
      next(reader)
      # we want to store each board as a list of rows and columns
      #   i.e. 5x5 board is a 5x10 list, this will make checking easier
      board = []
      for row in reader:
          print(row)
          if len(row) &lt; 1:
              boards.append(board[:] + list(map(list, list(zip(*board)))))
              board = []
          else:
              board.append([b[int(i)] for i in filter(None,row[0].split(&quot; &quot;))])
      
  for i in range(0, 100):
      b[i] = True
  
  print(boards[0])
  
  </code></pre>
  <p>I suspect the way that I append <code>board</code> to <code>boards</code> could be the culprit...</p>
  <p>You might recognize this as an 'advent of code' problem, I promise I can solve it with a more rudimentary technique, I just don't want to give up on this method... thank you!</p>