Probably seems like an incredibly trivial question, but I'm curious, and given:
foo = {1: 'one', 2: 'two'}
Is there a reason to prefer either one of the following two approaches?
if not 3 in foo:
    print 'bar'
if 3 not in foo:
    print 'bar'
Probably seems like an incredibly trivial question, but I'm curious, and given:
foo = {1: 'one', 2: 'two'}
Is there a reason to prefer either one of the following two approaches?
if not 3 in foo:
    print 'bar'
if 3 not in foo:
    print 'bar'
 
    
    They are functionally equivalent, though the latter is more pythonic.