String Identity Test

Benji York benji at
Tue Nov 1 15:04:38 CET 2005

Thomas Moore wrote:
> I am confused at string identity test:

>>>>a is b
> True

> About identity, I think a is not b, but "a is b" returns True.
> Does that mean equality and identity is the same thing for strings?


 >>> a = 'te' + 'st'
 >>> b = 'test'
 >>> a is b

You're seeing a coincidence of the implementation.
Benji York

More information about the Python-list mailing list