Callback Properties in Python
Project description
echo: Callback Properties in Python
Echo is a small library for attaching callback functions to property state changes. For example:
class Switch(object):
state = CallbackProperty('off')
def report_change(state):
print 'the switch is %s' % state
s = Switch()
add_callback(s, 'state', report_change)
s.state = 'on' # prints 'the switch is on'
CalllbackProperties can also be built using decorators
class Switch(object):
@callback_property
def state(self):
return self._state
@state.setter
def state(self, value):
if value not in ['on', 'off']:
raise ValueError("invalid setting")
self._state = value
Full documentation is avilable here
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
echo-0.8.0.tar.gz
(34.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
echo-0.8.0-py3-none-any.whl
(28.9 kB
view details)
File details
Details for the file echo-0.8.0.tar.gz.
File metadata
- Download URL: echo-0.8.0.tar.gz
- Upload date:
- Size: 34.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
726fb786d25781e7a4205aa15891e7ceab16141bc0e71ade92ec1557e59b22c3
|
|
| MD5 |
1099665ac250566484895f3012d0c828
|
|
| BLAKE2b-256 |
88769f195f336caaf440a4c38d7d2adf88ec44b2e9688ac05ec545a9ee5b6422
|
File details
Details for the file echo-0.8.0-py3-none-any.whl.
File metadata
- Download URL: echo-0.8.0-py3-none-any.whl
- Upload date:
- Size: 28.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cda500e45118cf244c0d6df19b20cdf3e294852a58d19f72102ff2141e4d6bb5
|
|
| MD5 |
4418953b573a70b31176a03f99dbe041
|
|
| BLAKE2b-256 |
adae72759368e28df08a71f2ce0a8efa37d0f43ff29fa19241da34ffdd0468e3
|