fdintino/pyzipcode — pull request #3 by wojcikstefan (2013-09-19 21:33:31+00:00)
Title: Speed up the `find_zip` method + support for exact queries and limits

Master branch:
```
In [3]: %timeit pyzipcode.ZipCodeDatabase().find_zip(state='CA')
10 loops, best of 3: 32 ms per loop
```

This PR:
```
In [2]: %timeit pyzipcode.ZipCodeDatabase().find_zip(state='CA')
10 loops, best of 3: 25.6 ms per loop

In [3]: %timeit pyzipcode.ZipCodeDatabase().find_zip(state='CA', exact=True)
100 loops, best of 3: 14.3 ms per loop

In [4]: %timeit pyzipcode.ZipCodeDatabase().find_zip(state='CA', exact=True, limit=1)
1000 loops, best of 3: 273 us per loop
```

The code is a bit less readable, but the performance gains are significant, especially if you don't need all the zip codes for a given city/state (hence the limit) and you're searching for an exact match.