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.tar.gz
(3.3 kB
view details)
File details
Details for the file callbacks-0.1.tar.gz.
File metadata
- Download URL: callbacks-0.1.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a6397e6783934c0bd3ad16d5e4bffc1ea0ece8f1dbfb6fc50fce554ba45128d
|
|
| MD5 |
d3327dfd144e6044d6c88873a8ec1749
|
|
| BLAKE2b-256 |
f660e64e301ae9e7d81f117bd4fa07e6f527aac0ada312ce2792eac809b75136
|