I have the following variables declared in a lot of functions, as I need those values in each one of them. Is there anyway I can declare them at a global scope or something, such as I won't have to declare them in all my methods? I am using all this methods on instance methods of a class of mine.
x = 0
y = 1
t = 2
In c# I'd just declare them as global class variables, but the problem is that I don't want to have to use them always as self.x, self.y and self.z, as it gets my algorithm's code uglier than it already is. How would you do this?
A typical usage of this would be:
def _GetStateFromAction(self, state, action):
x = 0
y = 1
t = 2
if (action == 0):
return (state[x], state[y] - 1, state[t])
if (action == 1):
return (state[x] - 1, state[y], state[t])