title: avoiding memoryError when dealing with large datasets in python
body: <p>I want to take a benchmark of the time it takes to sort large amounts of data using MergeSort, and I have the following script which opens several text files, reads them, and turns every line (which is a random integer between 1 and 999) into an integer element within a list.</p>
  
  <pre><code>data = []
  for file in ["10.txt", "100.txt", "1000.txt", "10000.txt", "100000.txt", "1000000.txt", "10000000.txt", "100000000.txt"]:
      tempList = []
      with open(file) as myfile:
          for line in myfile:
              tempList.append(int(line.rstrip()))
      data.append(tempList)
  </code></pre>
  
  <p>However, the issue is I get a memory error when trying to add 100,000,000 elements to a list. FileIO aside, I tried something alone the lines of this:</p>
  
  <pre><code>data = []
  for limit in [10, 100, 1000, 10000, 100000, 1000000, 10000000, 10000000]:
      tempList = []
      for i in range(limit):
          tempList.append(random.randint(1,999))
      data.append(tempList)
  </code></pre>
  
  <p>However, the same issue occurs; it simply can't handle 100 million items. Is this an issue with my machine (mine is fairly high end). Is there any more efficient way to do this?</p>