id == vs is

Roy Smith roy at panix.com
Mon Oct 27 09:17:34 EDT 2014


In article <mailman.15221.1414379336.18130.python-list at python.org>,
 Cameron Simpson <cs at zip.com.au> wrote:

> The "is" test is more direct and less subject to iffiness because the longer 
> expression using id() leaves more scope/time for things to change, and of 
> course "id" itself can be rebound to something weird.

Not to mention that Python is case-sensitive and in the code as 
presented by the OP:

>>>>Id(x) == id(y)

those are two different functions :-)



More information about the Python-list mailing list