I read this in the python docs: Docs
requiring global for assigned variables provides a bar against unintended side-effects.
Let's put this in code:
def double(n):
global y
y = 2 * n # this turns global as we have state y explicitly global
y = 5
double(y)
print y # outputs 10
I would like to double check my understanding if the above code has a side effect at global y if so I feel this is contradictory to the statement in the docs, basically I think requiring global for assigned variables does not guard against side effects.
Please correct me if I'm wrong.
Thanks