Returning inncorrect variables in python
<p>I am trying to make a simple project where balls bounce around the screen using object oriented. However, I can not get the correct variable to return. If I am tryin to return an integer, it instead returns: main.ball instance at 0x000000000924B648>></p>

<pre><code>def functionCallback(event):
    lB.append(ball(event.x, event.y, event.x+50, event.y+50))
    L.append(can.create_oval(event.x, event.y, event.x+50, event.y+50, fill = 'blue'))

class ball():

def __init__(self,x,y,x2,y2):
    self.x=x
    print self.x
    self.y=y
    self.x2=x2
    self.y2=y2
    self.xVel=random.randint(-15,15)
    self.yVel=random.randint(-15,15)

def getX(self):
    xx=self.x
    print xx
    return int(xx)

def getY(self):
    return int(self.y)

def getX2(self):
    return int(self.x2)

def getY2(self):
    return int(self.y2)

def getXV(self):
    return int(self.xVel)

def getYV(self):
    return int(self.yVel)

def setXV(self, num):
    self.xVel=self.xVel*num

def setYV(self, num):
    self.yVel=self.yVel*num

#this line is in a while loop and caused the error. It I replace any of the method calls with any of the return methods, I get the same error.
can.move(oval, lB[oval-1].getX, lB[oval-1].getY)
</code></pre>

<p>I have played around with casting it and setting other variables equal to it (which I know really wouldn't do anything). Any help would be appreciated.</p>

<p>I managed to find the problem. I needed to add () behind the method calls like: <code>can.move(oval, lB[oval-1].getX2(), lB[oval-1].getY())
</code></p>

python return object-oriented-analysis