DEV Community

Discussion on: Keeping your code clean by sweeping out "if" statements

Collapse
 
rogerthomas profile image
Roger • Edited

Thanks for the article. I found myself switching to this pattern a while ago. Especially in one case where I had 3 binary flags controlling logic, a dictionary (Python) with 8 tuples of 3 True/False values was so much neater. The only thing I'm still struggling with is the best way to handle when the provided key isn't one that's expected, essentially the equivalent final "else".