[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  阅读(54)  评论(0编辑  收藏  举报