title: Python can create large dicts in memory but can not load them from a file
body: <p>My work involves creating look up tables with python <code>defaultdict(set)</code>. Building all of these dicts takes about 20 minutes and uses about 2GB of ram. I am trying to save time by writing all of these dicts to a <code>.py</code> file and then loading them back in with an import.</p>
  
  <p>I'm writing the file with <code>theFile.write("idToName = {}\n".format(dict(idToName)))</code> to remove the set part of the <code>defaultdict</code> class. The file is about 500MB and the dicts all work fine. However, when I try to import the file back in it fills my ram and locks everything up. What would be causing this difference in ram usage?</p>