Skip to main content

Create classes whose instances have tracked methods

Project description

Create classes whose instances have tracked methods

spectate is useful for remotely tracking how an instance is modified. This means that protocols for managing updates, don’t need to be the outward responsibility of a user, and can instead be done automagically in the background.

For example, if it were desirable to keep track of element changes in a list, spectate could be used to observe list.__setitiem__ in order to be notified when a user sets the value of an element in the list. To do this, we would first create an elist type using expose_as, construct an instance of that type, and then store callback pairs to that instance’s spectator. To access a spectator, register one with watch (e.g. spectator = watch(the_elist)), retrieve a preexisting one with the watcher function. Callback pairs are stored by calling the watcher(the_list).callback method. You can then specify, with keywords, whether the callback should be triggered before, and/or or after a given method is called - hereafter refered to as “beforebacks” and “afterbacks” respectively.

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

spectate-0.1.0.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

spectate-0.1.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file spectate-0.1.0.tar.gz.

File metadata

  • Download URL: spectate-0.1.0.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for spectate-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4ab8d8097eb2c916b3ad39ae8910fe24e13ed0c74d26a7c61946791ab7874c3b
MD5 aa4dd31bdec306896051bfa74b9e8701
BLAKE2b-256 9d2a8a07f5a91b2e8626b1d8e583de4014036b539942153c09382bc28c498b56

See more details on using hashes here.

File details

Details for the file spectate-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for spectate-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 addfa642c40637380721917ba8928a9379bdd903673e95430797ea6c4f7eab78
MD5 d2adda240893143951d803d82df8a258
BLAKE2b-256 675569942fed800c7f407db5e7e9e4ea53920efa7898b5494aec2565be26fa89

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