D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Global variables in Python?

 

On Sat, Apr 27, 2013 at 11:28 PM, Grant Phillips-Sewell wrote:
> It would seem
> that I do have to declare each global that I want to use inside each
> function. Seems daft to me, but I can understand its value... and more
> importantly, I now know.

I think it makes some sense: if you're program is big then you may
have forgotten that SOMEVAR is a global variable by the time you write
your function, and your program may start to behave in odd ways.

But global variables are usually not a very good idea anyway. Can't
you use them as parameters of your functions?

Martijn.

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq