> In all cases, if the optional parts are omitted, the code is executed in the > current scope. ... > > > You can see from it that "globals" is optional. > And that, if "globals" is missing, then > "exec" is executed in the current scope ("f1" in your case).
Thank you for your answer, and that is exactly what confuses me? Where does x come from? If I only would read x then I would understand why it can be found/read but I alter it and as such I either have to provide the info that this is a global variable, declare it inside of f1 or provide the globals dict to exec. But I don't do any of it. Why is exec able to use the global x? Eren -- https://mail.python.org/mailman/listinfo/python-list