I thought I'd 'got' globals but...

nate n8pease at yahoo.com
Fri Jul 7 20:03:58 EDT 2006


> OK, so I should include the global only if I plan to modify it.
> Otherwise, I don't need to include it. Am I right?

I guess you could say that's true.  I'm hardly an expert so I couldn't
say there aren't other potential ramifications.  (anyone?)

But, as a rule I would declare the global variable always because
1) it makes my intention clear
2) if I later decided to modify the global variable, I would be less
likely to introduce a bug by forgetting to declare it global.




More information about the Python-list mailing list