diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -726,12 +726,20 @@ .. function:: locals() Update and return a dictionary representing the current local symbol table. - Free variables are returned by :func:`locals` when it is called in function + non-local names are returned by :func:`locals` when it is called in function blocks, but not in class blocks. .. note:: - The contents of this dictionary should not be modified; changes may not - affect the values of local and free variables used by the interpreter. + + The dictionary returned by locals() is an accurate snapshot of the local + namespace at the time it is called. After the call returns, changes to + one may or may not be reflected in the other. The dictionary may change + unpredictably after the call, and how it does is implementation-specific. + Holding a reference to the dictionary may produce surprising effects. In + addition, the contents of this dictionary should not be modified; whether + changes affect the values of local and non-local variables used by the + interpreter is undefined and cannot not be relied upon to either happen + or not happen. .. function:: map(function, iterable, ...)