A variable (or equivalently, a computed attribute) is specified either by an expression of by a fully-qualified name (see Section 24.3). Datasets automatically compute each variable when, and only when, needed. This mechanism uses the dependency information from each variable which gives an information about what variables this variable depends on. Additionally, it is checked if variable's dependent variables have changed (versioning mechanism). The computation is invoked by the dataset method compute_variables() which computes each of the given variables if either (a) this variable has not been computed before, or (b) the inputs to this variable (the values of variables upon which this variable depends) have changed since the last computation. Thus, invoking compute_variables() on a single variable may either result in no more computation, or have a ripple effect of computing many variables upon which this one variable depends. Lazily computing variables both helps minimize the computational load as well as eliminating the need to worry about when variables are computed: it will happen when, and only when, it is needed.
The method compute_variables() takes the following arguments:
names - a list of
variable names to be computed,
dataset_pool - an object of class DatasetPool which
maintains a 'pool' of additional datasets that the variables (and their dependent
variables) need for the computation (see Section 24.7.1), and
resources - an object of class Resources which can contain additional arguments
to be passed to each of the variable computation (see Section 24.3.2).