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.1.tar.gz
(3.4 kB
view details)
File details
Details for the file callbacks-0.1.1.tar.gz.
File metadata
- Download URL: callbacks-0.1.1.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dca91a170c8d8cbda1acb432f1f58884b3803351809b2df83bcd24f622b7d6f8
|
|
| MD5 |
7b6936d70026b563442ca1e930abfce1
|
|
| BLAKE2b-256 |
9da0e237b99c3acd6d4058c8b76f392aa9bf8afcbe1e73adeb7b775921a6cc84
|