1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| thing = None
if thing: print("It's some thing.") else: print("It's no thing.")
if thing is None: print("It's nothing") else: print("It's something")
def is_none(thing): if thing is None: print("It's None") elif thing: print("It's True") else: print("It's False")
is_none(None) is_none(True) is_none(False) is_none(0) is_none(0.0) is_none(()) is_none([]) is_none({}) is_none(set())
|