Dangerous global variables
Global variables can be dangerous and cause bugs because they can be simultaneously accessed from multiple sections of a program. Most global variable bugs are caused when one function reading and acting on the value of a global variable before another function has the chance to set it to an appropriate value. We recommend using a configuration module to mutate global state.
def dangerous_global_noncompliant(w):
    # Noncompliant: uses global variable, which can be accessed
    # from multiple sections.
    global width
    width = w
def dangerous_global_compliant(w):
    # Compliant: avoids using global variables, restricting
    # the scope to this method.
    width = w
    return width