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.5.tar.gz (32.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.5-py3-none-any.whl (27.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: echo-0.5.tar.gz
  • Upload date:
  • Size: 32.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.0

File hashes

Hashes for echo-0.5.tar.gz
Algorithm Hash digest
SHA256 fccacf010ac6d70a59d6f5553f3e50a380c14e1eb56c27eff2dbc5e7ccccc509
MD5 ca4de86da2a113db50ac0f4ec6f044ee
BLAKE2b-256 5c033b978975d57019a4ed75f3602c5de11b1443fd16a8e4f4c35f2424c92a9d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: echo-0.5-py3-none-any.whl
  • Upload date:
  • Size: 27.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.0

File hashes

Hashes for echo-0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f731a4b9def74795a56b68ee8c032a69950d0ab72bfa00193c688ad0ce429002
MD5 82ef500f80cd91e8b7dcbd8f9af26ab2
BLAKE2b-256 b906b60579742465ad8ccdaef5c7bb1db77f8530d547cc489a30987a70432bba

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