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.11.1.tar.gz
(38.1 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.11.1-py3-none-any.whl
(33.2 kB
view details)
File details
Details for the file echo-0.11.1.tar.gz.
File metadata
- Download URL: echo-0.11.1.tar.gz
- Upload date:
- Size: 38.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d5618331b6ac090d097df7aa468f0676cc88fbbbda64a650f42b4a1d80534b9
|
|
| MD5 |
3bfc9611a1376d2b8c821a796149d0cd
|
|
| BLAKE2b-256 |
382cdd1260ea921bf767ee6bc0f284615ab7fc75dcb7377ee694bf624103d362
|
File details
Details for the file echo-0.11.1-py3-none-any.whl.
File metadata
- Download URL: echo-0.11.1-py3-none-any.whl
- Upload date:
- Size: 33.2 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 |
aa3a2918b3cf2ada74d3928733a88072e7204bbfd3aff852e5b212d53ca48e4b
|
|
| MD5 |
3e94a3e6409f4cf9f7740e6d99037fb6
|
|
| BLAKE2b-256 |
be195914b6e3e033fd83ca68453ea55d0c47fcebc25071bf25d026a7a92144a2
|