The defaultdict option looks faster than the standard dict (20 secs aprox).
Now i have: ############################# import fileinput import sys from collections import defaultdict match_counter = defaultdict(int) for line in fileinput.input(sys.argv[1:]): match_counter[line.split()[0]] += 1 ############################# About generators, now i get the idea of when use them and when not. Thanks MRAB, Lie and Gary. Now not only is faster but also cleaner and easy to understand =)
-- http://mail.python.org/mailman/listinfo/python-list