DerivedCondition(formula, *values) - derive condition from value(s)
Usage:
# 'derived' is re-evaluated whenever x or y change
derived = DerivedCondition(lambda: x()>=y(), x, y)
A DerivedCondition fires an event equal to formula() whenever any of
the supplied values fire, the value of formula() is not equal to its
last known value (if any), and the value of formula() is true.
Note that like other events.IConditional implementations, callbacks
added to a DerivedCondition will be fired immediately if the current
value of formula() is true, and tasks yielding to a true
DerivedCondition will also proceed immediately without waiting for a
callback.
|