Commits

Michael Elsdörfer committed 8270fb1

Allow a standalone event to be created outside of a method definition.

  • Participants
  • Parent commits 89e3b6b

Comments (0)

Files changed (1)

pyutils/observer.py

 __all__ = ('event',)
 
 
-class event(object):
+def event(func=None):
+    if func:
+        return event_decorator(func)
+    else:
+        return boundevent()
+
+
+class event_decorator(object):
     def __init__(self, func):
         self.__doc__ = func.__doc__
         self._key = ' ' + func.__name__