The "is" statement should only be used when you want to check if
something is exactly and identical to None like "a is None" or "b is not None".
For everything else you should use == or !=.
There are some other use cases for "is", too.
But in general you shouldn't use "is".
snippsat
Practically a Posting Shark
808 posts since Aug 2008
Reputation Points: 353
Solved Threads: 294
You use 'is' to check the identity of objects ...
# 'is' checks object identities
# the id is a memory location
# in this case Python stores the 7 in the same location
a = 7
b = 7
print(id(a)) # 30626568
print(id(b)) # 30626568
print(a is b) # True
Do not use 'is' instead of '==' (there can be some problems).
vegaseat
DaniWeb's Hypocrite
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417