Thursday, 19 July 2012

Python Identity Operators:


Identity operators compare the memory locations of two objects.
There are two Identity operators explained below:



Operator
Description
Example
Is
Evaluates to true if the variables on either side of the operator point to the same object and false otherwise.
x in y, here is results in a 1 if id(x)  equals id(y).
is not
Evaluates to false if the variables on either side of the operator point to the same object and true otherwise.
x in y, here is not results in  1 if id(x)  is not equals to id(y).

No comments:

Post a Comment