Use getattr() instead of hasattr() since it does one less lookup.
Merge pull request #90 from dhui/pythonic

Use getattr() instead of hasattr() since it does one less lookup.