re: How to write cleaner functions. VIEW POST


Interesting article you wrote there!

I don't really agree with the switch case argument.

Arguably, it's way more clean looking when it comes to input handling. I tend to use it for preprocessing variables before transmitting them to a output or similar, it's nice to have them scoped.

Besides, 5 if conditions looks quite bad. Refactored to s switch case looks way better and much easier to read.

I'd probably also would love for the article to provide more proof of concepts to the arguments written.

it's very nice anywho. ✔️


Personally, I'm a fan of just using a Map instead of a switch. For me switch statements just seem overly verbose and less intuitive.


I have to totally agree with @genspirit up here. Even I always prefer Map, dicts against switch statements. I have updated the article accordingly. Do give a look and let me know.

code of conduct - report abuse