wthen
Wthen is a simple rule engine in Python, it is allowed to extract rules outside the program, but it's not business oriented. That means it is for developer or those whose are able to program with Python The name came from our daily speaking, when condition matched, then actions will be taken.
It leverages YAML
to provide an easy understanding rule format.
The conditions (When) are evalated by Python eval()
.
The actions (Then) are executed by Python exec()
Quick Example
- Given scinario:
- When
a (=2) > b (=1)
- Then
2 > 1
is printed out code:yaml rules:
- rule:
- When