[Python] __call__

[Python] __call__

class sample():
  def __call__(self,arg_call):
    print("__call__ is executed, the arg is %s")
a=sample()
a("test")

__call__ is executed, the arg is test

posted @ 2020-12-13 16:31  Harry666  阅读(58)  评论(0)    收藏  举报