title: Python list takes up too much memory
body: <p>If I execute these lines of code in python:</p>
  
  <pre><code>states = itertools.product("012",repeat = 16)
  states = list(states)
  </code></pre>
  
  <p>Then I use up more memory than I have on my laptop. Is there a way around this? I need this list of states so that when I generate a new state, I can update its value in the list. </p>
  
  <p>Edit:
  I'm storing these states for a 4x4 grid,where 0, 1, and 2 are the possible states of each square on the grid. The value being stored is actually a 16 length list that says what the reward is for making a move to any of the squares on the grid from the current state. With impossible moves being marked with -np.inf. As the game is played the reward for moves that lead to winning from certain states increases, so that the bot is more likely to make that move in the future. </p>
  
  <p>Ex: A simplified example for tic-tac-toe.</p>
  
  <pre><code>x| |o
   | | 
  o| | 
  </code></pre>
  
  <p>This state would be translated to a 9 length list, '102000200', and when it'd be looked up in the list of all possible states to see what the next best move is. Which in this case would be the middle spot for x.</p>