3 ms·
No idea what pypy does but cpython with the -O flag will. assert.py: a = 0 def gadd(b): global a a = a + b return a assert gadd(1) ==
by janzer 13y ago
No idea what pypy does but cpython with the -O flag will.
assert.py:
a = 0
def gadd(b):
global a
a = a + b
return a
assert gadd(1) == 1, 'a != 1'
print a
$python assert.py
1
$python -O assert.py
0