<br><br><div class="gmail_quote">On Wed, Jul 1, 2009 at 4:44 PM, Angus Rodgers <span dir="ltr">&lt;<a href="mailto:angusr@bigfoot.com">angusr@bigfoot.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello, world!<br>
<br>
This is my first post to the Tutor list (although I&#39;ve already<br>
posted to comp.lang.python a couple of times).<br>
<br>
I&#39;m currently reading Chapter 4 of Wesley Chun&#39;s book, &quot;Core<br>
Python Programming&quot; (2nd ed.).<br>
<br>
I find this, in Python 2.5.4, on my Win98SE system (using IDLE):<br>
<br>
&gt;&gt;&gt; n = &quot;colourless&quot;<br>
&gt;&gt;&gt; o = &quot;colourless&quot;<br>
&gt;&gt;&gt; n == o<br>
True<br>
&gt;&gt;&gt; n is o<br>
True<br>
&gt;&gt;&gt; p = &quot;green ideas&quot;<br>
&gt;&gt;&gt; q = &quot;green ideas&quot;<br>
&gt;&gt;&gt; p == q<br>
True<br>
&gt;&gt;&gt; p is q<br>
False<br>
<br>
Why the difference?<br>
<font color="#888888">--<br><br>
</font></blockquote></div><br><br>IIRC, in cPython (the &quot;defaul&quot; python available from <a href="http://python.org">python.org</a>), there is an optimization done for strings (and I think integers) below a certain size. This is an implementation detail, and could be different in (for instance) Jython.<br>