titus.util.DynamicScope

class titus.util.DynamicScope(parent)[source]

Bases: object

Keep track of a variable scope dynamically, for the sake of simulating lexical scope in a PFA document (ironically).

__init__(parent)
Parameters:parent (titus.util.DynamicScope or None) – scope to use for resolving variables not found in this scope
get(symbol)

Look up a variable, returning its value.

Parameters:symbol (string) – variable name to look up
Return type:anything
Returns:variable value
let(nameExpr)

Create a new variable.

Parameters:nameExpr (dict from new variable names to their initial values) – variables and values to assign
set(nameExpr)

Reassign variables.

Parameters:nameExpr (dict from new variable names to their new values) – variables and values to assign