Global variables

Mongryong Mongryong at sympatico.ca
Thu Feb 13 23:44:18 CET 2003


On Thu, 2003-02-13 at 23:30, laotseu wrote:
> gislan wrote:
> > Hi everyone
> > 
> > I have two questions
> > 
> > 1. Is there any reason for NOT using globall variables (I know that
> > using global variables in i.e. C isn't very good idea. What about
> > python?)
> 
> The language doesn't matter. Globals are *evil* ! Shoot'em all !
> 
No, not all globals are bad.  It's just that must people do not have an
understanding of how and when to properly use them so they're told to
just avoid them.  

For example, data that needs to be shared between different modules or
class objects are sometimes more efficiently done via a global or
'static class variable'.  You just need to be careful in 'threaded'
applications to provide read-write protection.   










More information about the Python-list mailing list