foo = [('x', 1), ('y', 2), ('z', 3)] bar = None if foo: bar = True else: bar = False
foo = [('x', 1), ('y', 2), ('z', 3)] bar = bool(foo)
Used when an if expression can be replaced with bool(test).
bool(test)