Skip to main content

Callback Properties in Python

Project description

Azure Status Coverage Status

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


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.0.tar.gz (37.4 kB view details)

Uploaded Source

Built Distribution

echo-0.11.0-py3-none-any.whl (32.6 kB view details)

Uploaded Python 3

File details

Details for the file echo-0.11.0.tar.gz.

File metadata

  • Download URL: echo-0.11.0.tar.gz
  • Upload date:
  • Size: 37.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for echo-0.11.0.tar.gz
Algorithm Hash digest
SHA256 85338c5c6a52113875a9c03cddd77e8d2fc000f241e8d4769a627d0b321d973d
MD5 1f5129b40d0d71f9d988ec335efcc7b3
BLAKE2b-256 a1444b2218167c09ac2915a669aa5fae7866f06b3b2bf4731c2bed14f5d5ad79

See more details on using hashes here.

File details

Details for the file echo-0.11.0-py3-none-any.whl.

File metadata

  • Download URL: echo-0.11.0-py3-none-any.whl
  • Upload date:
  • Size: 32.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for echo-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d6b2ab75db5a8c6e42a31692795d68778e92fb97eefcef3995a06c167f1b589f
MD5 11a3e10c3581726b5f8699cd4062a2e6
BLAKE2b-256 7bc4faa307d829c44a39ecb0ecbead136b457c84a1e13fb48dae6731cf68f2c5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page