title: In python,why use function to get class member?
body: <p>
  Hi, recently I read some codes of others , and found the differences between others and mine is that they often write a function to get class member. Like
  </p>
  
  <pre><code>def GetHeight
      return self.height
  </code></pre>
  
  <p>instead of just using</p>
  
  <pre><code>self.height
  </code></pre>
  
  <p>in the program.</p>
  
  <p>
  I mean, in C++, I know the function of this is to get <strong>private</strong> member.<br>
  In python, though everything is set as <strong>public</strong> (in normal cases) ,<br>
  Why it has reason to be used in python? Is that just bad code?
  Or something else I ignore?<br>
  I am kinda new to python, so I will appreciate it if you give some advice.<br>
  </p>
  
  <p><strong>EDIT:</strong><br>
  <a href="https://stackoverflow.com/questions/1568091/why-use-getters-and-setters-accessors">Similar Question</a> It seems my question has been identified as the duplicate of another one. I checked the answer and found the answer of that is more like general advice instead of pythonic programming.</p>
  
  <p>While the answer below introduces a feature of python -- <strong>property</strong><br>
  That possibly cannot be learned from that question, so it's the reason I think my question is unique.</p>