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.0.tar.gz (41.6 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.0-py3-none-any.whl (37.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: echo-0.12.0.tar.gz
  • Upload date:
  • Size: 41.6 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.0.tar.gz
Algorithm Hash digest
SHA256 562fec77d372e34662ba9360493b8fcf14bd2a68cab5e0de5ac41ae30d0bfd1b
MD5 997ede2e7ff7dc3661c29850c3b0d522
BLAKE2b-256 19f8e7e887ef8a8386bf08633a9eb649b512b43baf524ffdac63b14eb92ad4be

See more details on using hashes here.

File details

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

File metadata

  • Download URL: echo-0.12.0-py3-none-any.whl
  • Upload date:
  • Size: 37.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.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5408d31ed06524fd84029a0729f152d796f79dd52ba152fd6777625f821ccffa
MD5 577330a66f68af65987120b3412ec8b6
BLAKE2b-256 354d40c3824e983b22f329a218e3f89c0859251de5845ac8279070b153802b73

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