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.13.1.tar.gz (53.7 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.13.1-py3-none-any.whl (50.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for echo-0.13.1.tar.gz
Algorithm Hash digest
SHA256 4a4059b38ecbcf67a6a3ffd11c1fa3a71182776d5b9fe15feb91dc928cff13d5
MD5 556aeaf36a17b289116f905a41758fd9
BLAKE2b-256 77b2e8afa0299c10b0173b52787fd894c60ab3534df3faad8bf31ae5841e85ec

See more details on using hashes here.

File details

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

File metadata

  • Download URL: echo-0.13.1-py3-none-any.whl
  • Upload date:
  • Size: 50.1 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.13.1-py3-none-any.whl
Algorithm Hash digest
SHA256 049c344c2f600fcf41f5dd612d060cac53d3667f0ecf66c49b28d0ccc8267b55
MD5 338316d88266b442067423e2336c8988
BLAKE2b-256 48152a82f4e1af5cc3d7f9901a0e6c955da75007f7e0d3a70e1b2a40532109ea

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