In Py2 and Py3, hasattr() works by trying to get the attribute. But (I think) in Py2 any exception gets re-raised as AttributeError while in Py3 the actual exception gets raised. If it isn't AttributeError then hasattr() just raises an exception instead of giving False.
See the Hacker News thread "hasattr considered harmful" for background.
In Py2 and Py3, hasattr() works by trying to get the attribute. But (I think) in Py2 any exception gets re-raised as AttributeError while in Py3 the actual exception gets raised. If it isn't AttributeError then hasattr() just raises an exception instead of giving False.
See the Hacker News thread "hasattr considered harmful" for background.