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.11.1.tar.gz (38.1 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.11.1-py3-none-any.whl (33.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for echo-0.11.1.tar.gz
Algorithm Hash digest
SHA256 5d5618331b6ac090d097df7aa468f0676cc88fbbbda64a650f42b4a1d80534b9
MD5 3bfc9611a1376d2b8c821a796149d0cd
BLAKE2b-256 382cdd1260ea921bf767ee6bc0f284615ab7fc75dcb7377ee694bf624103d362

See more details on using hashes here.

File details

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

File metadata

  • Download URL: echo-0.11.1-py3-none-any.whl
  • Upload date:
  • Size: 33.2 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.11.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aa3a2918b3cf2ada74d3928733a88072e7204bbfd3aff852e5b212d53ca48e4b
MD5 3e94a3e6409f4cf9f7740e6d99037fb6
BLAKE2b-256 be195914b6e3e033fd83ca68453ea55d0c47fcebc25071bf25d026a7a92144a2

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