"/a" is not "/a" ?

skip at pobox.com skip at pobox.com
Sat Mar 7 01:57:43 CET 2009

    Steven> Mutable versus immutable is irrelevant. The complexity of the
    Steven> object is irrelevant. The phase of the moon is irrelevant. The
    Steven> *only* relevant factor is the programmer's intention:

Which for a new user not familiar with the differing concepts of "is" and
"==" can lead to mistakes.

    Steven> If you find it difficult to think of a reason for testing for
    Steven> identity, you're right, there aren't many. Since it's rare to
    Steven> care about identity, it should be rare to use "is". But in the
    Steven> few times you do care about identity, the correct solution is to
    Steven> use "is" no matter what sort of object it happens to be. It
    Steven> really is that simple.

Right.  Again though, when newcomers conflate the concepts they can deceive
themselves into thinking "is" is just a faster "==".


More information about the Python-list mailing list