In [1]:
def printer(*args, **kwargs):
print args, kwargs
def pretty_printer(*args, **kwargs):
import pprint
pprint.pprint(args)
pprint.pprint(kwargs)
def errorer(*args, **kwargs):
raise Exception
In [3]:
from observed import event
class C(object):
@event
def do(self, *args, **kwargs):
pass
c = C()
In [4]:
c.do.add_observer(printer)
c.do.add_observer(pretty_printer)
In [8]:
c.do(1, 2, a=3)
In [9]:
c.do.add_observer(printer)
c.do(1, 2, a=3)
In [10]:
@event
def do(*args, **kwargs):
pass
do.add_observer(errorer)
do.add_observer(printer)
do(1, 2, a=3)
Overall: medium (more recent, but essentially one quick burst)
In [ ]: