When if is just a function

What If Control Flow Were Just Functions? In Python, when you write if x > 5: print("big"), you’re using special syntax baked into the language. You can’t change how if works. You can’t compose it, pipe it, or partially apply it. You can’t pass if as an argument to another function. But what if you could? What if if, for, and while were just regular functions? This might sound like a theoretical curiosity, but it has real implications for how we write code. ...

October 6, 2025 · Janko