1.__ call__
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, …).
当对象像函数一样被调用时,就相当于执行它的__ call__方法.
class Test:
def __call__(self, *args, **kwargs):
print('shot')
t1 = Test()
t1()
#result
shot