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.8.0.tar.gz (34.2 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.8.0-py3-none-any.whl (28.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: echo-0.8.0.tar.gz
  • Upload date:
  • Size: 34.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for echo-0.8.0.tar.gz
Algorithm Hash digest
SHA256 726fb786d25781e7a4205aa15891e7ceab16141bc0e71ade92ec1557e59b22c3
MD5 1099665ac250566484895f3012d0c828
BLAKE2b-256 88769f195f336caaf440a4c38d7d2adf88ec44b2e9688ac05ec545a9ee5b6422

See more details on using hashes here.

File details

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

File metadata

  • Download URL: echo-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 28.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for echo-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cda500e45118cf244c0d6df19b20cdf3e294852a58d19f72102ff2141e4d6bb5
MD5 4418953b573a70b31176a03f99dbe041
BLAKE2b-256 adae72759368e28df08a71f2ce0a8efa37d0f43ff29fa19241da34ffdd0468e3

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