knit_script.knit_script_interpreter.scope.global_scope module
Used for tracking global variable space of program execution.
This module provides the Knit_Script_Globals class, which manages the global variable namespace for knit script program execution. It serves as a container for storing and accessing global variables that persist throughout the execution of a knit script program, including special system variables like exit values.
- class Knit_Script_Globals[source]
Bases:
object
Tracks all the global variables for knit script program execution.
The Knit_Script_Globals class provides a dynamic namespace for storing global variables that need to persist throughout the execution of a knit script program. It uses Python’s attribute system to allow flexible variable storage and retrieval, supporting any variable name that is a valid Python identifier.
This class is designed to be extensible, allowing new global variables to be added dynamically during program execution. It provides containment checking to determine whether specific variables have been defined in the global scope.
- exit_value
The exit value of the program, used to store the result or status when the program terminates. Initially set to None.
- Type:
Any
- __init__()[source]
Initialize the global variable tracker with default values.
Creates a new instance of the global variable space with the exit_value initialized to None. Additional global variables can be added dynamically by setting attributes on the instance.