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
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
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
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
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 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