Skip to content

Instantly share code, notes, and snippets.

@EntityReborn
Created November 9, 2011 20:28
Show Gist options
  • Save EntityReborn/1352887 to your computer and use it in GitHub Desktop.
Save EntityReborn/1352887 to your computer and use it in GitHub Desktop.
class Event(object):
def __init__(self):
self._subscribers = []
def attach(self, func):
self._subscribers.append(func)
def detach(self, func):
self._subscribers.remove(func)
def __call__(self, *args):
for func in self._subscribers:
func(*args)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment