Re: Does the "is" operator only matter for mutable object?
Laura Creighton <[email protected]> Sat, 05 Mar 2011 20:12:02 +0100
| Newsgroups | gmane.comp.python.documentation |
|---|---|
| Message-ID | <[email protected]> |
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 _______________________________________________ Doc-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/doc-sig