Python's locals() documentation says: Update and return a dictionary representing the current local symbol table. Free variables are returned by locals() when it is called in function blocks, but not in class blocks. What are in the current local symbol table exactly? Is the local symbol table guaranteed to be the same as the argument dict if locals() is called at the very beginning of a function? For example, if we have the following program: def foo(x, y): print(locals() == {'x': 1, 'y': 2}) foo(1, 2) Will it always output True no matter what platforms and Python implementations we use? Continue reading...