On 11/05/2014 04:11, Steven D'Aprano wrote:
[...]

And try running
this function in both 2.7 and 3.3 and see if you can explain the
difference:

def test():
     if False: x = None
     exec("x = 1")
     return x

I must confess to being baffled by what happens in 3.3 with this example. Neither locals() nor globals() has x = 1 immediately before the return statement, so what is exec("x = 1") actually doing?

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to