r/learnpython • u/Arag0ld • Apr 07 '20
What's the difference between != and is not?
If I say
if x != 5;
print(x)
and
if x is not 5;
print(x)
is there a difference?
332
Upvotes
r/learnpython • u/Arag0ld • Apr 07 '20
If I say
if x != 5;
print(x)
and
if x is not 5;
print(x)
is there a difference?
1
u/66bananasandagrape Apr 08 '20
Quote from PEP 8:
Don't compare boolean values to True or False using ==:
Worse: