In which cases should we use the is() function ? The is() function compares identity of objects rather than values so I was wondering in which circumstances comparing identities of objects is really vital.

Examining well reputated Python source code, I realize that is() function is mainly used in the following set form :

spam is None

But how much "spam is None" is different from "spam == None" ?



is() function makes comparaison of (abstract representation of) adresses of objects in memory. Comparing addresses of objects is a low level feature performed by low level langages such as C but seldom needed in high level languages like Python, isn'it ?
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to