Great article. I think the example for the walrus operator could be better. Something like # We want to increment by the number if it's nonzero, otherwise we want to increment by at least 1 x = get_some_number_maybe_0() if x: y += x else: y += 1 Which can be transformed with walrus operator to: if x := get_some_number_maybe_0(): y += x else : y += 1 If the example you've shown, should_run isn't necessary, you can just base the if statement on the return of the os.environ call. I guess the above could also be done as y += max(1, get_some_number_maybe_0()). Dammit, I need to stop finding ways to optimize my examples :P Edit: The PEP introducing the operator has some better, albeit more complicated examples https://www.python.org/dev/peps/pep-0572/#syntax-and-semantics