
callbacks = {}

def register(event, callback, *args, **kwargs):
    callbacks.setdefault(event, []).append(
        lambda: callback(*args, **kwargs)
    )

def clear():
    callbacks.clear()

def trigger(event):
    for callback in callbacks.get(event, []):
        callback()

# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4

@@ -1,9 +1,11 @@
 %0A
+__
 callback
@@ -60,24 +60,26 @@
 wargs):%0A    
+__
 callbacks.se
@@ -168,24 +168,26 @@
 lear():%0A    
+__
 callbacks.cl
@@ -233,16 +233,18 @@
 back in 
+__
 callback

Use __ for private variables