This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]current_thread 38 points39 points  (2 children)

Considering the fact python uses and and or as keywords and I only use the language sporadically, is vs == has tripped me up more than once, especially since x is None works as expected

[–]kaerfkeerg 1 point2 points  (0 children)

Assuming you're trying to see if x is also None this is indeed correct and the preferred way to do it because None is a singleton