@@ -1154,44 +1154,44 @@ are always available. They are listed here in alphabetical order.
11541154
11551155.. function :: locals()
11561156
1157- Return a mapping object representing the current local symbol table, with
1158- variable names as the keys, and their currently bound references as the
1159- values.
1160-
1161- At module scope, as well as when using :func: `exec ` or :func: `eval ` with
1162- a single namespace, this function returns the same namespace as
1163- :func: `globals `.
1164-
1165- At class scope, it returns the namespace that will be passed to the
1166- metaclass constructor.
1167-
1168- When using ``exec() `` or ``eval() `` with separate local and global
1169- arguments, it returns the local namespace passed in to the function call.
1170-
1171- In all of the above cases, each call to ``locals() `` in a given frame of
1172- execution will return the *same * mapping object. Changes made through
1173- the mapping object returned from ``locals() `` will be visible as assigned,
1174- reassigned, or deleted local variables, and assigning, reassigning, or
1175- deleting local variables will immediately affect the contents of the
1176- returned mapping object.
1177-
1178- In an :term: `optimized scope ` (including functions, generators, and
1179- coroutines), each call to ``locals() `` instead returns a fresh dictionary
1180- containing the current bindings of the function's local variables and any
1181- nonlocal cell references. In this case, name binding changes made via the
1182- returned dict are *not * written back to the corresponding local variables
1183- or nonlocal cell references, and assigning, reassigning, or deleting local
1184- variables and nonlocal cell references does *not * affect the contents
1185- of previously returned dictionaries.
1186-
1187- Calling ``locals() `` as part of a comprehension in a function, generator, or
1188- coroutine is equivalent to calling it in the containing scope, except that
1189- the comprehension's initialised iteration variables will be included. In
1190- other scopes, it behaves as if the comprehension were running as a nested
1191- function.
1192-
1193- Calling ``locals() `` as part of a generator expression is equivalent to
1194- calling it in a nested generator function.
1157+ Return a mapping object representing the current local symbol table, with
1158+ variable names as the keys, and their currently bound references as the
1159+ values.
1160+
1161+ At module scope, as well as when using :func: `exec ` or :func: `eval ` with
1162+ a single namespace, this function returns the same namespace as
1163+ :func: `globals `.
1164+
1165+ At class scope, it returns the namespace that will be passed to the
1166+ metaclass constructor.
1167+
1168+ When using ``exec() `` or ``eval() `` with separate local and global
1169+ arguments, it returns the local namespace passed in to the function call.
1170+
1171+ In all of the above cases, each call to ``locals() `` in a given frame of
1172+ execution will return the *same * mapping object. Changes made through
1173+ the mapping object returned from ``locals() `` will be visible as assigned,
1174+ reassigned, or deleted local variables, and assigning, reassigning, or
1175+ deleting local variables will immediately affect the contents of the
1176+ returned mapping object.
1177+
1178+ In an :term: `optimized scope ` (including functions, generators, and
1179+ coroutines), each call to ``locals() `` instead returns a fresh dictionary
1180+ containing the current bindings of the function's local variables and any
1181+ nonlocal cell references. In this case, name binding changes made via the
1182+ returned dict are *not * written back to the corresponding local variables
1183+ or nonlocal cell references, and assigning, reassigning, or deleting local
1184+ variables and nonlocal cell references does *not * affect the contents
1185+ of previously returned dictionaries.
1186+
1187+ Calling ``locals() `` as part of a comprehension in a function, generator, or
1188+ coroutine is equivalent to calling it in the containing scope, except that
1189+ the comprehension's initialised iteration variables will be included. In
1190+ other scopes, it behaves as if the comprehension were running as a nested
1191+ function.
1192+
1193+ Calling ``locals() `` as part of a generator expression is equivalent to
1194+ calling it in a nested generator function.
11951195
11961196 .. versionchanged :: 3.12
11971197 The behaviour of ``locals() `` in a comprehension has been updated as
0 commit comments