Planet Python 中文 关注 LernerPython 博客,作者 Reuven Lerner:Python 可调用对象:任何定义了 __call__ 的对象 在 Python 中,什么是“可调用”?通常是函数或类。但实际上,任何定义__call__的东西都是:类别我的课程: 反__call__(自制): 回应“嗨!”m = MyClass() m() # '嗨!'“可调用”内置的如果找到__call__,基本上会返回 True。 LernerPython blog, from Reuven Lerner: Python callables: Any object that defines __call__ lernerpython.com Planet Python 中文 RSS thenote.app