function

language.configurable

def configurable(target: typing.Any = None, strict: bool = True) -> typing.Any

Mark a callable as a configuration boundary for :func:`trace`.

**Outside a trace** the decorated callable executes normally — it is a transparent pass-through. **Inside a trace** it intercepts the call, converts positional arguments to named ones via :func:`inspect.Signature.bind` + :meth:`~inspect.BoundArguments.apply_defaults`, and emits an equivalent ``L.call`` node without running the target body. Usage as a bare decorator:: @L.configurable class Encoder: def __init__(self, depth: int): ... Usage as a factory (pass options):: @L.configurable(strict=False) class Encoder: def __init__(self, depth: int): ...

Parameters

NameTypeDescription
target = NonecallableWhen used as ``@L.configurable`` (no parentheses), the wrapped callable is passed here. When used as ``@L.configurable(…)``, ``target`` is ``None`` and a decorator factory is returned.
strict = ``True``boolForwarded to the underlying :func:`call` during tracing. When ``True``, unknown kwargs are validated against the target's signature at config-construction time. This knob is independent of the :func:`trace` ``strict`` flag, which governs the root-value check.

Source: laco/language.py:1085