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

Uploaded Source

Built Distribution

echo-0.9.0-py3-none-any.whl (30.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: echo-0.9.0.tar.gz
  • Upload date:
  • Size: 35.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for echo-0.9.0.tar.gz
Algorithm Hash digest
SHA256 1c65d7048b9f0a58c1e00676fb552cfd169ea171c0e674613849335a38793509
MD5 347044236caa9ee57f7d89b707efee66
BLAKE2b-256 436655592bc44fd3963e0532bc4d07bd028c7f6dd9fa70b003ce30cfac9e6690

See more details on using hashes here.

File details

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

File metadata

  • Download URL: echo-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 30.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for echo-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1abda40d223a4b85d5385343be7bdae5da76af195965cfbd099e366b9e26442e
MD5 7ca2ca44b83913428dde027defa270fe
BLAKE2b-256 10503ee693a6271654ef58e611c5b3ff720d2ce58edafffca1ca79f96605cfe9

See more details on using hashes here.

Supported by

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