What is the new way to test "called" methods in python 3.x?

I studied introspection in Python, and as I went through the basic examples, I found out that the callable built-in function callable no longer available in Python 3.1.

How to check if a method can now be called?

thanks

+7
python introspection
source share
3 answers
 if hasattr(f, "__call__"): 

What's New in Python 3.0

+5
source share

The built-in callable () function from Py2.x was resurrected in python3.2.

+17
source share
 isinstance(f, collections.Callable) 
+2
source share

All Articles