AI / Apache Burr Interview questions
List the built-in condition functions Burr provides for transitions?
Burr ships three convenience functions for writing transition conditions, all importable from burr.core:
from burr.core import when, expr, default with_transitions( ("from", "to", when(foo="bar")), # true when state["foo"] == "bar" ("from", "to", expr("epochs>100")), # true when the expression evaluates true ("from", "to", default), # always true, catch-all )
when() also accepts Django-style __ suffixes for richer comparisons, such as when(age__gte=18), when(status__in=["active","pending"]), or when(tags__contains="python"). Prefixing any condition with ~ inverts it, e.g. ~when(foo="baz").
More Related questions...