Simple callbacks using decorators
Project description
Callbacks lets you use decorator syntax to set callbacks on methods or functions.
[![Build Status](https://secure.travis-ci.org/14rcole/callbacks.svg?branch=master)](https://travis-ci.org/14rcole/callbacks)
[![Coverage Status](https://coveralls.io/repos/github/14rcole/callbacks/badge.svg?branch=master)](https://coveralls.io/github/14rcole/callbacks?branch=master)
```python
from callbacks import supports_callbacks
def callback():
print "Polly!"
@supports_callbacks
def target():
print "hello",
target.add_callback(callback)
target() # prints "hello Polly!"
```
[![Build Status](https://secure.travis-ci.org/14rcole/callbacks.svg?branch=master)](https://travis-ci.org/14rcole/callbacks)
[![Coverage Status](https://coveralls.io/repos/github/14rcole/callbacks/badge.svg?branch=master)](https://coveralls.io/github/14rcole/callbacks?branch=master)
```python
from callbacks import supports_callbacks
def callback():
print "Polly!"
@supports_callbacks
def target():
print "hello",
target.add_callback(callback)
target() # prints "hello Polly!"
```
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.3.0.tar.gz
(9.4 kB
view details)
Built Distribution
File details
Details for the file callbacks-0.3.0.tar.gz
.
File metadata
- Download URL: callbacks-0.3.0.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/2.7.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16248b2570394e06cc9c78f586f2582c36a677163e80f8735625d3904b3a5b65 |
|
MD5 | 3b434abc3ce719ee9876da327b2f9482 |
|
BLAKE2b-256 | eb15c71150189ea1cfd04a5853a40e2e074ec777755bd3924980fe51e5c6dd44 |
File details
Details for the file callbacks-0.3.0-py2-none-any.whl
.
File metadata
- Download URL: callbacks-0.3.0-py2-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/2.7.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44a3d8d8686e78ab223042910945bd1dffc25d668adb0b76c115f3bf3fdf0a1b |
|
MD5 | b2af3d16f257826d5834461369da0378 |
|
BLAKE2b-256 | 6cacb75152b8172643dcd2c337d201a3de7d2e5d795a0d010aad2d1a31705d63 |