title: Python 2.7 passing an object to a class function
body: <p>I'm trying to test out my 2D coordinate and vector classes in python. Here is the code where the vector and coordinate classes are defined:</p>
  
  <pre><code>class coord(object):
      def __init__(self,x,y):
          self.x = x
          self.y = y
      def resolve(endCoord):
          return vector((self.x-endCoord.x),(self.y-endCoord.y))
  
  class vector(object):
      def __init__(self, xTrans, yTrans):
          self.xTrans = xTrans
          self.yTrans = yTrans
          self.magnitude = sqrt((self.xTrans**2)+(self.yTrans**2))
  </code></pre>
  
  <p>I then test these with the statements below:</p>
  
  <pre><code>inp1 = raw_input("Please enter the first coordinate: ")
  inp2 = raw_input("Please enter the second coordinate: ")
  coord1 = coord(int(inp1[0]), int(inp1[2]))
  coord2 = coord(int(inp2[0]), int(inp2[2]))
  vector1 = coord1.resolve(coord2)
  print "Vector magnitude is "+str(vector1.magnitude) 
  </code></pre>
  
  <p>I get a problem with the line:</p>
  
  <pre><code>vector1 = coord1.resolve(coord2)
  </code></pre>
  
  <p>where it throws this error:</p>
  
  <pre><code>exceptions.TypeError: resolve() takes exactly 1 argument (2 given)
  </code></pre>
  
  <p>I don't know how to fix it. The inp1 I give is "0,0" (without the quote marks) and for inp2 I give "5,5" (again no quotes)</p>
  
  <p>I think it might be an issue either with giving an object as a function argument or the fact I am giving a coordinate as a function parameter, when the function is inside the coordinate class?</p>
  
  <p>I don't really know, any help would be appreciated!</p>