Help on scope/namespace
Alex Martelli
aleax at aleax.it
Sun Feb 2 12:29:52 EST 2003
Mike Meyer wrote:
...
> without breaking them - this should be easy, as you turn:
>
> def function(arg):
> global globvar
> ...
>
> into
> def function(arg, globvar):
> ...
>
> Any function that does an assignment to a global variable can't be
> changed this way. Take all the functions that can be rewritten, move
If a function does NOT assign to global globvar, then the function
should NOT have a "global globvar" statement, as such a statement
would then be redundant. So, there's something strange in this
advice, IMHO.
Alex
More information about the Python-list
mailing list