上代码.
class Event(list):
def __call__(self, *args, **kwargs):
for f in self:
f(*args, **kwargs)
def f(arg): print 'execute with arg',arg
e = Event()
e.append(f)
e('kzc')#触发事件
e.remove(f)
原文:http://blog.csdn.net/handsomekang/article/details/40040441