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