Catch both IndexError and TypeError (tests now pass with numpy).
Reflow docstrings to 72 column limit and fix some minor PEP-8
violations.