<div>Hi,</div>
<div> </div>
<div>This is my frist post here. I am learning Python and Qt and am trying to understand a pecularity with object references. I think I get the integer part, but for floating point it seems like the caching/interning process works a little bit here and there:</div>

<div> </div>
<div>1) Same object on command line</div>
<div>&gt;&gt;&gt; a, b = 5.0, 5.0<br>&gt;&gt;&gt; id(a), id(b)<br>(11140648, 11140648)</div>
<div><br>2) Different object on command line</div>
<div>&gt;&gt;&gt; a = 5.0<br>&gt;&gt;&gt; b = 5.0<br>&gt;&gt;&gt; id(a), id(b)<br>(11140616, 11140600)</div>
<div> </div>
<div>3) Same object in script</div>
<div>When running the last assignments for the float objects in a script (point 2) above, one line per assignment), it is cached again and the variables refer to the same object. Why is it different on a command line and in a script?</div>

<div> </div>
<div>How can you know when you create a new object or not, are there any rules?</div>
<div> </div>
<div>Thanks for a great forum.</div>
<div> </div>
<div>Regards,</div>
<div>Bjorn</div>