title: Google Style Guide properties for getters and setters
body: <p>I'm curious about one of the recommendations in the <a href="https://google.github.io/styleguide/pyguide.html#Properties" rel="nofollow noreferrer" title="Google Python style guide concerning properties">Google Python style guide concerning properties</a>. </p>
  
  <p>In it, they give the following example:</p>
  
  <pre><code>class Square(object):
      """A square with two properties: a writable area and a read-only perimeter.
  
      To use:
      &gt;&gt;&gt; sq = Square(3)
      &gt;&gt;&gt; sq.area
      9
      &gt;&gt;&gt; sq.perimeter
      12
      &gt;&gt;&gt; sq.area = 16
      &gt;&gt;&gt; sq.side
      4
      &gt;&gt;&gt; sq.perimeter
      16
      """
  
      def __init__(self, side):
           self.side = side
  
      def __get_area(self):
          """Calculates the 'area' property."""
          return self.side ** 2
  
      def ___get_area(self):
          """Indirect accessor for 'area' property."""
          return self.__get_area()
  
      def __set_area(self, area):
          """Sets the 'area' property."""
          self.side = math.sqrt(area)
  
      def ___set_area(self, area):
          """Indirect setter for 'area' property."""
          self.__set_area(area)
  
      area = property(___get_area, ___set_area,
                      doc="""Gets or sets the area of the square.""")
  
      @property
      def perimeter(self):
          return self.side * 4
  </code></pre>
  
  <p>I have two questions about this:</p>
  
  <ol>
  <li><p>What is the benefit of using the three underscore "indirection" <code>___get_area</code> and <code>___set_area</code> as well as two underscore ones, over just using the two underscore ones directly?</p></li>
  <li><p>Why use <code>property()</code> as a method with this set of double and triple underscore methods, rather than doing something like:</p>
  
  <pre><code>@property
  def area(self):
      return self.side ** 2
  
  @area.setter
  def area(self, value):
      self.side = math.sqrt(value)
  </code></pre></li>
  </ol>