Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/dabeaz/python-cookbook
/ test2
Function
test2
src/9/executing_code_with_local_side_effects/example.py:13–19 ·
view source on GitHub ↗
()
Source
from the content-addressed store, hash-verified
11
print(x)
# --> 0
12
13
def
test2():
14
x = 0
15
loc = locals()
16
print(
'before:'
, loc)
17
exec(
'x += 1'
)
18
print(
'after:'
, loc)
19
print(
'x ='
, x)
20
21
def
test3():
22
x = 0
Callers
1
example.py
File · 0.85
Calls
no outgoing calls
Tested by
no test coverage detected