[Tutor] Global Variables
ALAN GAULD
alan.gauld at btinternet.com
Sun Nov 22 00:01:25 CET 2009
> > This looks for or creates an nl in your module.
> Beg to differ- global will not create it.
>
> def f():global a
> What it does is alert the compiler that assignment to the
> variable will make it global.
Thats what I meant, that an assignment to a variable marked
as global inside a function will create the variable in the
global namespace rather than in the local one, if it does not
already exist.
But I didn't explain it very well...
Alan G.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20091121/a03f6a68/attachment.htm>
More information about the Tutor
mailing list