Python

ResultTerm

ResultTerm class and public members in the unified Python API.

Class: ResultTerm

Python · dataclassSince v0.10.0
ResultTermfrozen=True
Immutable raw output value returned by enumerate_raw(). It retains its result owner for resolution; do not manufacture it as input. Symbol IDs are scoped to that result, not the Ruleset.
Creation and access

Internal constructor — do not call. Raw view returned by SolveResult.enumerate_raw, carrying its result owner and lifetime; do not manufacture it.

  • returned by
    SolveResult.enumerate_raw()

    Lists a derived relation as typed ResultTerm records, keeping symbols as IDs local to this live result.

Fields
kindstrproperty
Term kind: symbol, integer or boolean.
valueint | boolproperty
Result-local numeric symbol ID, signed integer, or boolean according to kind.
Methods
  • ResultTerm.resolve()Resolves this raw term through its owning result to obtain the corresponding Python value.
Example
term = result.enumerate_raw("allow", 2)[0][0]
print(term)
print("resolved:", term.resolve())
ResultTerm(kind='symbol', value=1)
resolved: alice

Methods

Each method has its own signature, arguments, return behavior and stable link.

ResultTerm.resolve

This is the convenient form of result.resolve_term(term); it uses the result retained as the term owner.

Python · methodSince v0.10.0
ResultTerm.resolve
ResultTerm.resolve() -> object
Resolves this raw term through its owning result to obtain the corresponding Python value.
Return value
object

Returns the plain str, int or bool value. The owning result must still be open; a result-local symbol ID alone is not a reusable input.

Example
term = result.enumerate_raw("allow", 2)[0][0]
print("resolved:", term.resolve())

Usage guides