[ Date Index ]
[ Thread Index ]
[ <= Previous by date /
thread ]
[ Next by date /
thread => ]
Re: [LUG] Global variables in Python?
- To: list@xxxxxxxxxxxxx
- Subject: Re: [LUG] Global variables in Python?
- From: Martijn Grooten <sweetwatergeek@xxxxxxxxx>
- Date: Sat, 27 Apr 2013 23:44:35 +0100
- Delivered-to: dclug@xxxxxxxxxxxxxxxxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=HsxHXY8YDKOTvlaGLYsoO2ETWll9+7BJxAURXNyDCe8=; b=0GO6eAgzjdEei8Vff2+dgGsm7kAX2Y02WtQZagb3EezvsUYZQDhVKkVdG59HCdYKAw RmVKkydVIf+B7e9O0qAR+Ny19n5GXL0ud7SHuHwvdZY1IoaTTtrKJuoovSTAB9nXFlvh ug94Uh0aTHla2YWsSwMhSToVdhY4MsCEbYk5yuqBKsJX4+Ro/I/ARhBfPrq/JxcITYQV PjNixHXTLGWWTaj6H6j++07q6R8ENFRc+2kqewJPqIeynEggACU46bV3N4qGe/5cC8po +vgDDv69RxweOAEb7xVnCN5fFmMuzkynphhq9T7un1TTgRz2eGc8o4yU/d/SULhVaB36 7RNA==
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