title: Storing and checking a boolean in a python class
body: <p>So I was trying to create an object which basically has a constructor that takes two coordinates, <code>xcoord</code> and <code>ycoord</code>. I further created methods which shift the coordinates and I have to check if the point is valid or not(criteria for validity is if the coordinates are out of a specified range it should return <code>False</code> else <code>True</code>). </p>
  
  <h3>Problem:</h3>
  
  <p>My class only returns the validity for the initial points, not the shifted points. </p>
  
  <p>What do I need to correct my code?</p>
  
  <h3>Code:</h3>
  
  <pre><code>class Point:
      MaxScreenSize=10
      def __init__(self,x,y):
          self.xcoord=x
          self.ycoord=y
          if 0&gt;self.xcoord or self.xcoord&gt;Point.MaxScreenSize or 0&gt;self.ycoord or self.ycoord&gt;Point.MaxScreenSize:
              Point.isValidPt=False
          else:
              Point.isValidPt=True
      def translateX(self,shiftX):
          self.xcoord=self.xcoord+shiftX
      def translateY(self,shiftY):
          self.ycoord=self.ycoord+shiftY
  </code></pre>
  
  <h3>Test Code:</h3>
  
  <p>I tried my code and it only returns the <code>isValidFunction</code> variable for my initial points (gives me <code>True</code> instead of <code>False</code> for following code)</p>
  
  <pre><code>p=Point(9,2) 
  p.translateX(20)
  p.translateY(10)
  p.isValidPt
  </code></pre>