A observer pattern implementation in Python based on jQuery.
Project description
The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods [1].
The observer.py implementation has a topic-based system, a message filtering type of the publish–subscribe pattern (an observer pattern variation) [2]. Therefore, a subject can be subdivided into topics and observers can express interest in one (or more) topic and only receive notifications (with any message or not) from that.
The implementation is also based on the jquery publish–subscribe model [3] [4]. So, for convenience, observers will be called handlers and topics will be called events. The observer module has only two members: Event and Observable. An Observable instance allows you connect different handlers to its events. A handler can be any function, method or callable object.
A simpler implementation of the pattern can be found at old.py.
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pattern-observer-1.0.0.tar.gz
.
File metadata
- Download URL: pattern-observer-1.0.0.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1aed03adacf1068c89d94187ff194cc0a8856000fcc032dca1e7a6a5aa9988cf |
|
MD5 | 67859e7217626759ab519b1e8c6a7709 |
|
BLAKE2b-256 | dc569425a90dd71179a279ce2b027d851235ebf526a34bcdf53125df7480a601 |
File details
Details for the file pattern_observer-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: pattern_observer-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07eeeaf93b851ccd4c2ca2cc6565f28e8e81c7c2c3502524613dd175f810cade |
|
MD5 | 274fd19367ef5b80f9c0949da5d212a2 |
|
BLAKE2b-256 | 0617abe74c22416f9b0801e374f106e55cadde3778866ac019874071847ad556 |