[Doc-SIG] Does the "is" operator only matter for mutable object?

Laura Creighton lac at openend.se
Sat Mar 5 20:12:02 CET 2011


In a message of Sat, 05 Mar 2011 09:06:22 PST, Aahz writes:
>+1 -- here's my rewrite for a bit more clarity:
>
>The operators ``is`` and ``is not`` compare whether two objects are
>really the same object (have the same memory location).  Immutable
>objects with the same value and type may be cached to the same object for
>efficiency.  For example, ``'spam' is 'spam'`` is either ``True`` or
>``False`` depending on Python implementation.  Singleton objects
>(``True``, ``False``, ``None``) are always the same object.

I like Aahz's version.
Laura



More information about the Doc-SIG mailing list