Re: [Python-Dev] global statements outside functions/methods should raise SyntaxError

2009-11-15 Thread Guido van Rossum
On Sun, Nov 15, 2009 at 12:38 PM, Terry Reedy wrote: > Ezio Melotti wrote: >> >> Python currently accepts global statements at the top level: >> >> I opened an issue on the tracker (http://bugs.python.org/issue7329) >> and Benjamin suggested to discuss this here. >> The test he mentioned is in tes

Re: [Python-Dev] global statements outside functions/methods should raise SyntaxError

2009-11-15 Thread Terry Reedy
Ezio Melotti wrote: Python currently accepts global statements at the top level: I opened an issue on the tracker (http://bugs.python.org/issue7329) and Benjamin suggested to discuss this here. The test he mentioned is in test_global.py: def test4(self): prog_text_4 = """\ global x x

Re: [Python-Dev] global statements outside functions/methods should raise SyntaxError

2009-11-15 Thread MRAB
Benjamin Peterson wrote: 2009/11/15 Michael Foord : Well, personally I think it would be a good thing if this raised an exception during bytecode compilation - but it would fall under the moratorium and have to wait a few years. It could probably be considered a bug, though, since the global s

Re: [Python-Dev] global statements outside functions/methods should raise SyntaxError

2009-11-15 Thread Benjamin Peterson
2009/11/15 Michael Foord : > Well, personally I think it would be a good thing if this raised an > exception during bytecode compilation - but it would fall under the > moratorium and have to wait a few years. It could probably be considered a bug, though, since the global statement in that case s

Re: [Python-Dev] global statements outside functions/methods should raise SyntaxError

2009-11-15 Thread Michael Foord
Ezio Melotti wrote: 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 the global foo ... func() 5

[Python-Dev] global statements outside functions/methods should raise SyntaxError

2009-11-15 Thread 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 the global foo ... func() 5 # it works! "glob