title: python memory usage dict and variables large dataset
body: <p>So, I'm making a game in Python 3.4. In the game I need to keep track of a map. It is a map of joined rooms, starting at (0,0) and continuing in every direction, generated in a filtered-random way(only correct matches for the next position are used for a random list select).</p>
  
  <p>I have several types of rooms, which have a name, and a list of doors:</p>
  
  <pre><code>RoomType = namedtuple('Room','Type,EntranceLst')
  typeA = RoomType("A",["Bottom"])
  ...
  </code></pre>
  
  <p>For the map at the moment I keep a dict of positions and the type of room:</p>
  
  <pre><code>currentRoomType = typeA
  currentRoomPos = (0,0)
  navMap = {currentRoomPos: currentRoomType}
  </code></pre>
  
  <p>I have loop that generates 9.000.000 rooms, to test the memory usage.
  I get around 600 and 800Mb when I run it.
  I was wondering if there is a way to optimize that.</p>
  
  <p>I tried with instead of doing </p>
  
  <pre><code>navMap = {currentRoomPos: currentRoomType}
  </code></pre>
  
  <p>I would do </p>
  
  <pre><code>navMap = {currentRoomPos: "A"}
  </code></pre>
  
  <p>but this doesn't have a real change in usage.</p>
  
  <p>Now I was wondering if I could - and should - keep a list of all the types, and for every type keep the positions on which it occurs. I do not know however if it will make a difference with the way python manages its variables.</p>
  
  <p>This is pretty much a thought-experiment, but if anything useful comes from it I will probably implement it.</p>