API documentation

panglery!

panglery.Pangler

A pangler.

Panglers store hooks for events and dispatch to these hooks when an event is triggered. Event parameters can be modified or added.

Panglers also implement the descriptor protocol. If a Pangler is fetched as an instance attribute (iff it was originally a class attribute), a new Pangler will be produced which is bound to the relevant instance. Like bound methods, bound Panglers will pass self as the first parameter to their event hooks when triggered.

Bound Panglers are also persisted; fetching a Pangler from the same instance twice will produce the same bound Pangler both times. This is useful when trying to add new hooks per-instance.

Normally, an instance can only have one Pangler bound to it in this way because of the way bound Panglers are stored. To allow an instance to have multiple Panglers bound and stored, one must pass the id parameter when instantiating a Pangler. The provided id will be used as the store key instead of the default.

If a Pangler has an id of None, binding it will never store the bound Pangler.

panglery.PanglerAggregate

A means for aggregating Panglers.

PanglerAggregates will walk the MRO of a class, collecting Panglers which are exposed as a class attribute with a particular name, and combine them together into one Pangler.

Previous topic

panglery!

This Page