What is the new way of checking "callable" methods in python 3.x?
I was studying introspection in Python, and as I was getting through basic examples, I found out that the callable
built-in function is no longer available in Python 3.1.
How c开发者_如何学Can I check if a method is callable now?
Thank you
The callable() builtin function from Py2.x was resurrected in python3.2.
if hasattr(f, "__call__"):
What's New In Python 3.0
isinstance(f, collections.Callable)
精彩评论