id == vs is

Dan Stromberg drsalists at gmail.com
Mon Oct 27 01:12:29 CET 2014


Are the following two expressions the same?

x is y

Id(x) == id(y)

?

I ported some Java code to Python, and it was using Java's idea of
equality (via ==) in some places.  Right now, I have a suite of unit
tests working using the second expression above, but I'm thinking
about switching to the first.

Thanks!



More information about the Python-list mailing list