[Python-Dev] Re: would warnings be appropriate for probably-misused global statements?
Wed, 6 Nov 2002 13:39:22 -0500
"Alex Martelli" <firstname.lastname@example.org> wrote in message
> I've recently helped clarify a few users' confusion about what the
> statement is for, and I'm starting to think that it might help
> confusion if "global" gave warnings when used in
> not inside a function,
Yes. This could even be made a syntax error, as with other contextual
SyntaxError: 'continue' not properly in loop
SyntaxError: 'break' outside loop
# these messages should be same
>>> return 0
SyntaxError: 'return' outside function
# so why not " 'global' outside function"
> or about a variable that the function does not, in
> fact, bind nor re-bind.
No. This can serve as documentation and/or preparation/protection for
possible revision that does rebind.
Terry J. Reedy