PyMyth: Global variables are evil... WRONG!

jongiddy jongiddy at gmail.com
Tue Nov 12 09:12:10 EST 2013


On Tuesday, November 12, 2013 2:06:09 AM UTC, Rick Johnson wrote:

> 
> ============================================================
> 
>  Justifying Global Variables:
> 
> ============================================================
> 
> Globals are justified when they are used to communicate
> 
> information between scopes that otherwise were meant to be
> 
> mutually exclusive. One good example would be package sub-
> 
> modules.
> 

Can you please give an example where having a module provide a global variable would work better than any of:
1. providing a module function to change the operation of my module
2. providing a class with a method to change the operation of an instance
3. providing an additional parameter to module functions / instance methods to change operation
4. providing additional module functions / instance methods to perform different operations



More information about the Python-list mailing list