Is None == None

Hi everyone. What is the difference between is None and == None ?? I have seen both used when checking for the presence of a node in a linked list ? I am familiar with the comparison operator but what the ■■■■ is “is”.

One compares equality, the other identity (is it the same object).
You’ll see is used where you want to check if you are dealing with the same object or not (normally used for singletons like None) as suggested in PEP-8

1 Like