Discuss / Python / 鸭子特性

鸭子特性

Topic source

class Timer(object): def run(self): print('Start...')

run_twice(Timer()) Start... Start...

不要求传入的参数一定是Animal类,只需要含有run()方法就可以了。


  • 1

Reply