开发者

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)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜