EPI - CH12 - Sort a large file of lines of variable length.

Use an R-way external sort. Split file into R partitions, sort
each partition in-memory, write each out to a temporary file. Then
use a min-heap (the heapq module) to merge the files line by line.