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

Uploaded Python 3

File details

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

File metadata

  • Download URL: echo-0.2.tar.gz
  • Upload date:
  • Size: 32.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

File hashes

Hashes for echo-0.2.tar.gz
Algorithm Hash digest
SHA256 50473083b662ec971aaf926f3b3ca703f416e2756522dd4c26da437f897ae0e1
MD5 c11c1601811540307f75ee469554e098
BLAKE2b-256 7cf167ecb36ad46f77abd52a4dc110f0e3fc518e42245ab4cf955ab39d3a3c39

See more details on using hashes here.

File details

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

File metadata

  • Download URL: echo-0.2-py3-none-any.whl
  • Upload date:
  • Size: 27.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

File hashes

Hashes for echo-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d2d8d3b20ef0f0e31f1329a0971696888b7e328512fb01297f13e244eb5d7533
MD5 47b001e52e3feb62b78031eb4d2080d7
BLAKE2b-256 f5561b0d8283d42562fbb7f83e95ec6efdaa52c41b111d0e5d56a840f8859af1

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