From fa836aaad9bfe60801288cc519718e5e3124704c Mon Sep 17 00:00:00 2001 From: Jonathan Grizou Date: Thu, 4 Jul 2013 00:05:59 +0200 Subject: [PATCH] events.py more clean --- papers/events.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/papers/events.py b/papers/events.py index 29771a6..6fd77e6 100644 --- a/papers/events.py +++ b/papers/events.py @@ -9,16 +9,16 @@ class Event(object): """ This function sends the instance of the class, i.e. the event to be sent, to all function that listen to it. """ - if self.__class__.__name__ in _listener: - for f, args in _listener[self.__class__.__name__]: + if self.__class__ in _listener: + for f, args in _listener[self.__class__]: f(self, *args) @classmethod def listen(cls, *args): def wrap(f): - if cls.__name__ not in _listener: - _listener[cls.__name__] = [] - _listener[cls.__name__].append((f, args)) + if cls not in _listener: + _listener[cls] = [] + _listener[cls].append((f, args)) # next step allow us to call the function itself without Event raised def wrapped_f(*args):