synt.expr.condition
¤
Condition
¤
Bases: Expression
Conditional expression, aka if - else
.
References
Source code in synt/expr/condition.py
true_expr
instance-attribute
¤
|
expr.Expression to evaluate and return if the condition is true.
false_expr
instance-attribute
¤
|
expr.Expression to evaluate and return if the condition is false.
__init__
¤
|
Initialize a new conditional expression.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
condition |
IntoExpression
|
Condition expression. |
required |
true_expr |
IntoExpression
|
expr.Expression to evaluate and return if the condition is true. |
required |
false_expr |
IntoExpression
|
expr.Expression to evaluate and return if the condition is false. |
required |
Source code in synt/expr/condition.py
ConditionBuilder
¤
Builder for Condition
.
Source code in synt/expr/condition.py
__init__
¤
|
Initialize an empty condition builder.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
condition |
IntoExpression
|
Condition expression. |
required |
true_expr |
IntoExpression
|
expr.Expression to evaluate if the condition is true. |
required |
Source code in synt/expr/condition.py
false_expr
¤
|
Set the expression to evaluate if the condition is false.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
e |
IntoExpression
|
expr.Expression to evaluate. |
required |
build
¤
Build the condition.
Raises:
Type | Description |
---|---|
ValueError
|
If any of the required field is empty. |
Source code in synt/expr/condition.py
else_
¤
|
Set the false_expr
and build the builder.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
other |
IntoExpression
|
expr.Expression to evaluate if the condition is false. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If any of the required field is empty. |