titus.inspector.defs.switch

titus.inspector.defs.switch(*pairs)[source]

Helper function for cond-logic in a Python lambda expression.

Part of a poor-man’s functional programming suite used to define several pfainspector commands as one-liners.

Parameters:pairs (callables) – sequence of predicate1, consequent1, predicate2, consequent2, ..., alternate; the predicates will each be called in turn until one returns True, and then the corresponding consequent will be called or the alternate will be called if none of the predicates return True