0

What is difference between "is" and "=="?

Can anyone explain what is difference between "is" and "=="? example: x = 2 if x is 2: do something OR x = 2 if x == 2: do something

30th Jul 2016, 2:34 AM
Tigran Z
Tigran Z - avatar
1 Resposta
+ 3
the == operator compare the values is operator check if the referenced objects are the same. see this discussion: http://stackoverflow.com/questions/132988/is-there-a-difference-between-and-is-in-JUMP_LINK__&&__python__&&__JUMP_LINK
30th Jul 2016, 5:48 AM
samuel delepoulle
samuel delepoulle - avatar