[Tutor] When are strings interned?

Marc Tompkins marc.tompkins at gmail.com
Thu Jul 2 03:43:04 CEST 2009


On Wed, Jul 1, 2009 at 5:29 PM, Robert Berman <bermanrl at cfl.rr.com> wrote:

> > >>> n = "colourless"
> > >>> o = "colourless"
> > >>> n == o
> > True
> > >>> n is o
> > True
> > >>> p = "green ideas"
> > >>> q = "green ideas"
> > >>> p == q
> > True
> > >>> p is q
> > False
> >
> > Why the difference?
>
> The string p is equal to the string q. The object p is not the object q.
>
> Robert
>
Yes, but did you read his first example?  That one has me scratching my
head.
-- 
www.fsrtechnologies.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090701/bc38d564/attachment.htm>


More information about the Tutor mailing list