title: How does python function return objects?
body: <p>In the below diagram, I have a query on name <code>temp</code> that is returned from function <code>f</code></p>
  
  <p><img src="https://i.stack.imgur.com/mNXXu.png" alt="enter image description here"></p>
  
  <p>In local frame <code>f</code>,  <code>temp</code> is a reference variable pointing to an object <code>6</code> of class <code>int</code>, when you say <code>return temp</code> in <code>f</code>  a reference variable <code>output</code> which is part of <code>checkPassingMech</code>  frame will point to the same object <code>6</code> that temp was pointing to.</p>
  
  <p>My question:</p>
  
  <p>Q1) Is my understanding correct? </p>
  
  <p>Q2) If Q1 is  yes, then this diagram is giving an illusion that <code>temp</code> is not reference type and showing its value in a box rather than with an arrow pointing to 6, am i correct?</p>
  
  <p>Q3) If Q2 is yes, then, Can i say that <code>6</code> is actually stored in heap and <code>temp</code> and <code>output</code> would be pointing to this heap space from frame(local stack)</p>