Mixins (qcip_tools.mixins
)
Useful patterns.
API documentation
- class qcip_tools.mixins.Dispatcher
Implement the dispatcher pattern:
use
@Class.register(key)
to register a new callback underkey
;use
dispatch(key)
to access this callback.
Source: https://zestedesavoir.com/tutoriels/1226/le-pattern-dispatcher-en-python/ (in french).
- dispatch(key, default=None)
Access to a registered callback
- Parameters:
key (str) – the key
default – default value
- Return type:
function