对象后面加括号时,触发执行。python
注:code
列子---> 和 __init__ 结合着看对象
class Foo: # 这边 建立实例时候回触发 __init__ def __init__(self): print('__init__触发了') def __call__(self, *args, **kwargs): print('__call__触发了') obj = Foo() # 执行 __init__ # 输出结果 # __init__触发了 obj() # 执行 __call__ # 输出结果 # __call__