I have a function that is being run over and over again. Inside that function I want a specific segment to be run only the first time the function is run.
I can't use any variables from outside the functions, e.g.
firstTime = True
myFunction(firstTime): #function is inside a loop
if firstTime == True:
#code I want to run only once
firstTime = False
#code I want to be run over and over again
Neither do I want to use a global variable.
Any ideas how to accomplish this?