Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

A observer pattern implementation in Python based on jQuery.

Project description

https://img.shields.io/badge/license-MIT-blue.svg http://img.shields.io/pypi/v/pattern-observer.svg https://img.shields.io/pypi/status/pattern-observer.svg https://img.shields.io/travis/fernandojunior/observer.svg https://img.shields.io/codecov/c/github/fernandojunior/observer.svg

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.

Project details


Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pattern-observer, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size pattern_observer-1.0.0-py3-none-any.whl (8.3 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size pattern-observer-1.0.0.tar.gz (6.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page