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
- Host: GitHub
- URL: https://github.com/ext/pylistener
- Owner: ext
- Created: 2010-07-22T15:55:07.000Z (almost 16 years ago)
- Default Branch: master
- Last Pushed: 2010-07-22T21:10:30.000Z (almost 16 years ago)
- Last Synced: 2024-11-26T01:45:46.759Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 93.8 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
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