I have a Django program (so Python) with a global variable:
g_variable = []
I use this several functions, where I also change the value:
my_function()
global g_variable
g_variable.append(some_value)
This worked great until I started calling multiple program overlaps - in Django this means that I loaded the webpage several times quickly. I expected that the global variable would only be global in each individual run, but it is not. The values ββthat are added to g_variable in one pass can be seen in the next run.
For me, this means that now I have to pass this variable to all my functions:
my_function(non_g_variable)
non_g_variable.append(some_value)
return non_g_variable
called by
non_g_variable = my_function(non_g_variable)
? , , . .