handsome-ocean-90256
09/28/2023, 8:14 AMdry-beach-38304
09/28/2023, 8:30 AMhandsome-ocean-90256
09/28/2023, 8:50 AMhandsome-ocean-90256
09/28/2023, 9:02 AMdry-beach-38304
09/28/2023, 9:04 AMdry-beach-38304
09/28/2023, 9:08 AMif not skip_condition:
# Do step
self.next(...)
It’s defintely nicer but just want to be clear on the semantics.handsome-ocean-90256
09/28/2023, 9:51 AMflat-hospital-6180
09/28/2023, 6:24 PMhandsome-ocean-90256
09/29/2023, 8:01 AMflat-hospital-6180
09/29/2023, 8:54 AM@switch(
cases: [
("<var1>", "<comparatorN>", "condition1"),
...
("<varN>", "<comparatorN>", "conditionN"),
],
actions: [
(<task1> or <action1>,
...
(<taskN> or <actionN>,
]
default: <taskDefault> or <actionDefault>,
switch_engine: <switch- action>
)
cases: list of 'cases' wherein case is a "tuple" / Pydantic Object/schema of what-to-compare, to-how-compare, compare-with
actions: list of 'actions' wherein action is a task a.k.a self.next(...) or an "action" vis-a-vis a method that is a custom delegation of decision-making in case of the condition
*length of 'cases' and 'actions' array need to be same. Ofcourse, if no condition met, a 'default' task or custom method, must kick in.
Alternatively, one may just specify a "switch_engine" implementation, that decides for itself and yields a final task to be executed next.
* both switch_engine and (cases, actions, default) cant be Non-empty at the same time, still in case, the "switch_engine" gets the precedence.
let me know if you are convinced with this proposal or have thoughts to better this. Also FYI @handsome-ocean-90256 and @dry-beach-38304 as you've been part of this thread 🙂 !square-wire-39606
08/27/2025, 9:30 PM