title: How to use __repr__ method python 2.7
body: <p>I need to define a class of polygons in 2D.
  Each polygon defined by a list of tuples(coordinates) for example:</p>
  
  <pre><code>poly = [(0.5,0),(1,0.5),(0.5,1),(0,0.5)]
  </code></pre>
  
  <p><em>(There is no need for sorting)</em>
  The points are sorted clockwise starting from the most left point.</p>
  
  <p>My task is to define this class properly
   <code>__init__</code>, <code>__repr__</code>  and  <code>is_inside(self, q)</code> function that checks weather a point is inside the polygon.</p>
  
  <p>The <code>__repr__</code> method supose to print <code>'[(0.5,0),(1,0.5),(0.5,1),(0,0.5)]'</code></p>
  
  <p>So far this is what I have:</p>
  
  <pre><code>class Polygon2D:
      def __init__(self, pts):
          for index in range(len(pts)):
              self.index = pts[index]
      def __repr__(self):
  
          return str(self)
  </code></pre>
  
  <p>When I try to run it the program crashes. Please help me!!</p>