sha*_*pan 12 python events delegates function-pointers event-handling
基本上我是C#开发人员,我知道C#的做法,EventHandler,委托,甚至......
但最好的方法是在Python上实现它.
Emi*_*nov 18
我认为你应该能够使用一个功能:
def do_work_and_notify(on_done):
// do work
on_done()
def send_email_on_completion():
email_send('joe@example.com', 'you are done')
do_work_and_notify(send_email_on_completion)
Run Code Online (Sandbox Code Playgroud)
python中的函数(甚至方法)是一流的对象,可以像语言中的任何其他东西一样被抛出.
| 归档时间: |
|
| 查看次数: |
6312 次 |
| 最近记录: |