[issue7329] global statements outside functions/methods should raise SyntaxError

2009-11-21 Thread Raymond Hettinger
Raymond Hettinger added the comment: I concur. -- nosy: +rhettinger resolution: -> rejected status: open -> closed ___ Python tracker ___ ___

[issue7329] global statements outside functions/methods should raise SyntaxError

2009-11-20 Thread Terry J. Reedy
Terry J. Reedy added the comment: I once proposed this change, but became less supportive as I can to appreciate have fewer rather than more special-case rules. With Gabriel's explanation, I now oppose the idea and think this should be closed. -- nosy: +tjreedy

[issue7329] global statements outside functions/methods should raise SyntaxError

2009-11-16 Thread Gabriel Genellina
Gabriel Genellina added the comment: The compiler doesn't know how the code is going to be used apart from the "mode" parameter: py> c=compile("x=1","","exec") py> import dis py> dis.dis(c) 1 0 LOAD_CONST 0 (1) 3 STORE_NAME 0 (x)

[issue7329] global statements outside functions/methods should raise SyntaxError

2009-11-15 Thread Benjamin Peterson
Benjamin Peterson added the comment: Please bring this up on Python-dev if you'd like to change it. The fact that there's a test verifying that this can happen suggests there is some reason. -- ___ Python tracker _

[issue7329] global statements outside functions/methods should raise SyntaxError

2009-11-15 Thread Ezio Melotti
New submission from Ezio Melotti : Python currently accepts global statements at the top level: >>> global foo >>> Beside being a meaningless operation, this might lead unexperienced user to make mistakes like: >>> foo = 5 >>> global foo # make foo global >>> def func(): ... print foo # access