locals()

A built-in function that returns a dictionary of the current local variable names and their values.

In more detail

The course uses it with a format string, template.format(**locals()), to fill named fields from variables of the same names. It is handy but hides which variables a template needs, so f-strings are usually clearer today.

Related terms

Taught in

References