I have been testing various ways to read and write text files with GZIP in Python. There were a lot of uninteresting results, but there were two I thought were worth sharing.
If you have a big list of strings to write to a file, you might be tempted to do:
f = gzip.open(out_path, 'wb')
for line in lines: