Globals
Newt
newt_e at blueyonder.co.uk
Wed Oct 16 13:11:16 EDT 2002
Hi,
What's the best 'way' of defining globals?
To better express my self, if I wanted to have strVar (a string), iVar (an
integer) (for example) as globals, I assume I'd have to declare them in my
main program:
strVar = ""
iVar = 0
and use the global command when ever I wanted to reference them:
global strVar
global iVar
Questions:
1. Is this the correct/best way?
2. To save typing in all the global statements, can I put them in to an
include file or a source file?
3. If I declare them in a .py file, do I still need the global commands to
use them within Classes and Functions etc defined within that same module?
Thanks
Newt
More information about the Python-list
mailing list