---
title: "Nickolai Belakovski (@actinium226) | Hashnode"
description: "Nickolai Belakovski (@actinium226) writes on Hashnode. Read their latest articles and follow their work."
url: "https://hashnode.com/@actinium226"
---

@actinium226

# Nickolai Belakovski

@actinium226 · Joined October 2020

## Comments

[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](https://hashnode.com/posts/python-gotchas/5f93f46afbdce372c9a56d6b/comment/5f9487f440346172a86c1dcc)

Comment · Article · Oct 24, 2020 · [Python Gotchas: 5 Worst Mistakes You Should Avoid](https://hashnode.com/posts/python-gotchas/5f93f46afbdce372c9a56d6b)
