id == vs is
python at mrabarnett.plus.com
Mon Oct 27 01:20:24 CET 2014
On 2014-10-27 00:12, Dan Stromberg wrote:
> 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.
More information about the Python-list