python __call__函数

Emulating callable objects

object.__call__(self[, args...])

Called when the instance is “called” as a function; if this method is defined, x(arg1, arg2, ...) is a shorthand for x.__call__(arg1, arg2, ...).

当这个实例被当做一个函数调用时调用;如果定义了这个方法,x(arg1, arg2, ...)是x.__call__(arg1, arg2, ...)的一个简写。

你可能感兴趣的:(python __call__函数)