Derived from the flake8-bugbear linter.
Fix is sometimes available.
What it does#
Checks for uses of
hasattr to test if an object is callable (e.g.,
Why is this bad?#
hasattr is an unreliable mechanism for testing if an object is
obj implements a custom
__getattr__, or if its
is itself not callable, you may get misleading results.
callable(obj) to test if
obj is callable.