six.hasattr()? Behaving like Python 3 - not swallowing _all_ exceptions

Issue #151 new
Alex Willmer
created an issue

Would a function that backports hasattr() from Python 3 to Python 2 be appropriate?

On Python 2 hasattr() masks any exception, whereas on Python 3 it only masks AttributeError.

More info: hasattr() a dangerous misnomer Existing implementation: https://pypi.python.org/pypi/hasattr-safe

If you're interested I'll prepare a PR.

Comments (0)

  1. Log in to comment