My guess is that Python sees the space and decides it isn't a short string so it doesn't get interned. I got the expected results when I used 'green_ideas' instead of 'green ideas'. -Drew
On Wed, Jul 1, 2009 at 6:43 PM, Marc Tompkins<marc.tompk...@gmail.com> wrote: > On Wed, Jul 1, 2009 at 5:29 PM, Robert Berman <berma...@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 > > _______________________________________________ > Tutor maillist - tu...@python.org > http://mail.python.org/mailman/listinfo/tutor > > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor