Default values if somevar is None: somevar = somedefaultvar vs. somevar = somevar if somevar else somedefaultvar Check multiple items in list if 'key1' in os.environ and 'key1' in somelist: ... vs. if {'key1', 'key2'} in somelist: ...