Say I have a function inside of a loop that takes several parameters, but only one of which actually changes from iteration to iteration of the loop.
Example:
for i in range(10):
function(i, a, b, c, d, e)
Would I be losing speed by repeated passing arguments a, b, c, d, e into the function? I understand something vaguely about how all mutable types are passed in a "reference-like" manner. What would be a better way to do this?
I've tried this:
a =
b =
...
def function(i)
for i in range(10):
function(i)
and it seems to work.
Frustratingly, the below does not seem to work and I have not been very successful in understanding online explanations of why not:
from somemodule import function
for i in range(10):
function(i)
where function is defined same as above. I keep getting a "global variable a, b, c ... cannot be found" ERROR.