I have the following variables declared in many functions, since I need these values โโin each of them. In any case, can I declare them on a global scale or something like that, for example, I do not have to declare them in all my methods? I use all of these methods in the instance methods of my class.
x = 0
y = 1
t = 2
In C #, I simply declare them as global class variables, but the problem is that I donโt always want to use them as self.x, self.y and self.z, since it gets my algorithm the code is uglier than it already is. How do you do this?
A typical use 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])
source
share