June 2023
Intermediate to advanced
316 pages
4h 31m
Japanese
1 #!/usr/bin/env python 2 import sys, re, operator, string 3 4 # 5 # イベント管理基盤 6 # 7 class EventManager: 8 def __init__(self): 9 self._subscriptions = {} 10 11 def subscribe(self, event_type, handler): 12 if event_type in self._subscriptions: 13 self._subscriptions[event_type].append(handler) 14 else: 15 self._subscriptions[event_type] = [handler] 16 17 def publish(self, event): 18 event_type = event[0] 19 if event_type ...
Read now
Unlock full access