A simple events handler package.
Project description
Dyspatch
A simple package that implements basic events handling in Python.
Installation
pip install dyspatch
Usage
A basic example is as follows:
import dyspatch
users = []
def on_room_join(user):
print(f'{user} joined the room.')
users.append(user)
print(f'We now have {len(users)} users')
events = dyspatch.Events()
events.add_listener('room_join', on_room_join)
events.dispatch('room_join', args=['Alex'])
events.dispatch('room_join', args=['Bob'])
The output is like this:
Alex joined the room.
We now have 1 users
Bob joined the room.
We now have 2 users
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dyspatch-0.0.1-py3-none-any.whl.
File metadata
- Download URL: dyspatch-0.0.1-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca82c2d0d25f3587944a824685d30729cc7528a2c5d12fdb6e7419f8bb3acb11
|
|
| MD5 |
abf9697355bebd39db4c1420e45bd1f1
|
|
| BLAKE2b-256 |
5a941585c9630877021232755ea0b4b03a9cf34a29d7094c21d33dcda849c286
|