A poorly-architected event dispatcher that does magic and lets you do terrible things
Project description
Why you shouldn’t use this
ZPED let’s you do some truly silly stuff with event dispatching. There’s a built-in decorator that will create and execute pre/post execution events on functions, which is pretty cool! Until you realize that your event listeners can arbitrarily modify the execution of your code by raising exceptions. A pre-execution event can completely modify the data sent to the executing function, or even the data sent to other listeners (since they’re executed in serial). The same event can even stop execution entirely and force return a value. A post-execution event can do similar. It’s insane, it’s terrible, it will make your applications /really/ hard to debug.
Why I even wrote this
I’m in the process of writing a static website generator based on Flask, and I needed a good way to let plugins tie into the core system. One of the better days to do this is with event dispatching! So I started writing a simple dispatcher, because using an external library for that seemed silly. Then I thought, “If I were insane and writing a plugin to heavily modify the generator’s internals, but didn’t want to fork the code or monkeypatch… what would I need?” ZPED is the culmination of that, and entirely too much coffee.
Ok, but… I don’t /have/ to use the bad parts of this, right?
No, but power corrupts.
Just tell me how to use it
Look at the tests, I’ll write some docs later.
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
File details
Details for the file zped-0.1.3.tar.gz.
File metadata
- Download URL: zped-0.1.3.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82c83886ce48063538a48fe287a65649911f7ea157406f09549399a52345848c
|
|
| MD5 |
086f09763408424af97c85c66a6de295
|
|
| BLAKE2b-256 |
b74bf5af17388fa99d06009dd624aedfbd1b85d442b218dcfd83dbbf7f7977e6
|