osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

exec and globals and locals ...


No, I have to correct myself

x = 5
def f1():
    exec("x = x + 1; print('f1 in:', x)")
    return x
print('f1 out', f1())

results in the same, for me confusing, results.

f1 in: 6
f1 out 5

Eren