Factory functions
Depending on whom you ask, this sort of behavior is also sometimes called a closure
or factory function. These terms refer to a function object that remembers values in
enclosing scopes regardless of whether those scopes are still present in memory. Although
classes (described in Part VI of this book) are usually best at remembering state
because they make it explicit with attribute assignments, such functions provide an
alternative.