rrthomas/occurs — pull request #1 by mhl (2011-10-14 11:30:14+00:00)
Title: small improvements to occurs.py

There are six commits here with small improvements (I hope!) to `occurs.py`. It would be nice to use `fileinput` with a with statement, i.e.

with fileinput.input(files=(f,)):
occurs(h, f)

... so you don't need the explicit `close`, but the context manager for `FileInput` was only added in Python 3.2.

Using `collections.Counter` (since Python 2.7) instead of dict doesn't actually save any lines in this case, but it's probably slightly less error-prone.