Possible Duplicate:
String comparison in Python: is vs. ==
When is the==
operator not equivalent to theis
operator? (Python)
I'm pretty new to Python still. I heard someone say use is
, not ==
because "this isn't C". But I had some code x is 5
and it was not working as expected.
So, following proper Python/PEP style, when is the time to use is
and when is the time to use ==
?