1. Benjamin Peterson
  2. six
  3. Issues
Issue #151 new

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

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