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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

echo-0.12.1-py3-none-any.whl (37.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for echo-0.12.1.tar.gz
Algorithm Hash digest
SHA256 17ef1998628a6e152b1bf7551b1004df5fcd80f307f0f31fb18c4d651f74120d
MD5 61d12341bd44fa76d239d18baf0d09d4
BLAKE2b-256 cf8181fa1d2e2d719fd899afd5ec9a00ae275a7ab3d8e4b08dce142d6e77d040

See more details on using hashes here.

File details

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

File metadata

  • Download URL: echo-0.12.1-py3-none-any.whl
  • Upload date:
  • Size: 37.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.12.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6ed2bd6d7c4cd03c3c347dbd317d323b17535803dec6fd96b1dc5944e3e3688a
MD5 bb496108b9bb12420c6660587885b294
BLAKE2b-256 54d77bc8335b630590cdefc863cac834f4504797a409d6c0a3fc20e0ff96d745

See more details on using hashes here.

Supported by

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