An open API service indexing awesome lists of open source software.

https://github.com/ext/pylistener

Oberver pattern in python
https://github.com/ext/pylistener

Last synced: 12 months ago
JSON representation

Oberver pattern in python

Awesome Lists containing this project

README

          

Library for easy usage of observable pattern.

>>> @interface
>>> class SampleListener(Listen):
>>> @event
>>> def foo(self,a,b,c):
>>> raise NotImplementedError
>>>
>>> class Sample(SampleListener):
>>> def __init__(self, name):
>>> SampleListener.__init__(self)
>>> self.name = name
>>>
>>> def foo(self,a,b,c):
>>> print self.name, a,b,c
>>>
>>> a = Sample('fred')
>>> b = Sample('barney')
>>> SampleListener.foo(1,2,c=3)
fred 1 2 3
barney 1 2 3