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.13.0.tar.gz
(51.5 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.13.0-py3-none-any.whl
(47.6 kB
view details)
File details
Details for the file echo-0.13.0.tar.gz.
File metadata
- Download URL: echo-0.13.0.tar.gz
- Upload date:
- Size: 51.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58e5e0ccaa368d0eaea78dc4c61aa6e289d8b925ca050179b4a4303e574d6698
|
|
| MD5 |
8d66a005b52c0ded68d43c689596cee7
|
|
| BLAKE2b-256 |
09ed6e5ccb0d54ffd6d8e6ddc1265a7c078364e212687fc334aec55841fff471
|
File details
Details for the file echo-0.13.0-py3-none-any.whl.
File metadata
- Download URL: echo-0.13.0-py3-none-any.whl
- Upload date:
- Size: 47.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1969dcc151c9c2ab271aceb059ced0856a679db7f7f761da85472d07921f5c3c
|
|
| MD5 |
f9c5ba165e1a65fc140acabc98ca046f
|
|
| BLAKE2b-256 |
7f057604d355194ee98c69bb198157d8c28e9652b9b3ca565666ec8a78cf95b3
|