Here's the code I'm trying to use. Works just fine if I use getset_pos as a function instead of a method here. edit: correction to line 6 (getset_pos is now self.getset_pos); edit2: added call to class at end
class Main:
def __init__(self):
self.i = [5, 5]
self.o = []
self.getset_pos(self.i, self.o)
def getset_pos(self, input, output):
""" Takes the coord of an item and sets it equal to another item """
output = []
for numb in input:
output.append(numb)
print output
test = Main()
test
I could have the getset_pos() method work specifically for self.i and self.o variables, however, I found this was more of what I wanted:
class Main:
def __init__(self):
self.i = [5, 5]
self.o = []
def getset_pos(input, output):
output = []
for numb in input:
output.append(numb)
return output
getset_pos(self.i, self.o)
test = Main()
test
This function will just allow me to update the value of a variable to another variable more easily whenever I call this function. I only need to call it within the method.