diff -r 48743ad2d2ef Doc/reference/simple_stmts.rst --- a/Doc/reference/simple_stmts.rst Tue May 10 19:16:03 2011 +0200 +++ b/Doc/reference/simple_stmts.rst Tue May 10 16:53:59 2011 -0400 @@ -980,8 +980,8 @@ This statement supports dynamic execution of Python code. The first expression should evaluate to either a string, an open file object, or a code object. If it is a string, the string is parsed as a suite of Python statements which is -then executed (unless a syntax error occurs). [#]_ If it is an open file, the file -is parsed until EOF and executed. If it is a code object, it is simply +then executed (unless a syntax error occurs). [#]_ If it is an open file, the +file is parsed until EOF and executed. If it is a code object, it is simply executed. In all cases, the code that's executed is expected to be valid as file input (see section :ref:`file-input`). Be aware that the :keyword:`return` and :keyword:`yield` statements may not be used outside of @@ -992,7 +992,12 @@ current scope. If only the first expression after :keyword:`in` is specified, it should be a dictionary, which will be used for both the global and the local variables. If two expressions are given, they are used for the global and local -variables, respectively. If provided, *locals* can be any mapping object. +variables, respectively. If provided, *locals* can be any mapping object. When +the code contains only the first expression after :keyword:`in` or the same +dictionary is used for both the global and local variables, the code is executed +in a new top-level scope. However, when two different objects are used for the +global and local variables, the code is executed as if it were in a class +statement in a new top-level scope. .. versionchanged:: 2.4 Formerly, *locals* was required to be a dictionary.