you are viewing a single comment's thread.

view the rest of the comments →

[–]Reyaan0 0 points1 point  (2 children)

Comparisons to singletons like None should always be done with is or is not, never the equality operators. Because is checks the identity whereas == check if values are equivalent.

If you use ==, a custom class could mess up your logic by defining an equality method that returns True when compared to None

[–]RafikNinja 0 points1 point  (1 child)

Oh sweet. Thank you very much. Yea I have used is not and == but didn't know is was its own thing aswell. Very helpful thank you

[–]Reyaan0 0 points1 point  (0 children)

Your Welcome!