Simple callbacks using decorators
Project description
Callbacks lets you use decorator syntax to set callbacks on methods or functions.
```python
from callbacks import supports_callbacks
def callback():
print "Polly!"
@supports_callbacks
def target():
print "hello",
target.add_callback(callback)
print "This should print 'hello Polly!':"
target() # prints "hello Polly!"
```
[](https://travis-ci.org/davidlmorton/callbacks)
```python
from callbacks import supports_callbacks
def callback():
print "Polly!"
@supports_callbacks
def target():
print "hello",
target.add_callback(callback)
print "This should print 'hello Polly!':"
target() # prints "hello Polly!"
```
[](https://travis-ci.org/davidlmorton/callbacks)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
callbacks-0.1.3.tar.gz
(3.6 kB
view hashes)