re: Python 'is' vs '==' VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Interesting. Thanks for the heads up. Except in some extremely rare, hack-y scenarios, you should only see is in the context of is None. You kn...
 

Well, no, you wouldn't want to do that. if not a is the accepted shorthand for if a == False, but False and None are distinct values. You should always explicitly test for None, although you can implicitly test for "not None":

if foo:
    # foo has value (not None) OR foo is True

if not foo:
    # foo is False

if foo is None:
    # foo is None
code of conduct - report abuse