class Event(object):
def __init__(self):
self.m=[]
def __call__(self,hand):
def hand_w(hand):
return self.__call__(hand)
return hand_w
self.m.append(hand)
def send(self,a):
self.m.hand(a)
on_ooo=Event()
for k, v in globals().items():
if isinstance(v, Event):
setattr(v, "name", k)
@on_ooo
def message(self,a):
l=[]
l.append(a)
on_ooo.send(4)#这里会调用 message()
https://github.com/newlife/django-socketio/blob/master/django_socketio/events.py
2013-11-13修改了格式
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
人生最曼妙的风景,竟是内心的淡定与从容!