DEV Community

Discussion on: Programming Language Dictatorship

Collapse
zoedreams profile image
☮️✝️☪️🕉☸️✡️☯️ • Edited

also you might want to consider using a switch statement in your cover art ;)

Collapse
vsapronov profile image
Vladimir Sapronov Author

If only Python would have switch statement...

Collapse
zoedreams profile image
☮️✝️☪️🕉☸️✡️☯️

you mean

def switch_demo(argument):
    switcher = {
        1: "January",
        2: "February",
        3: "March",
        4: "April",
        5: "May",
        6: "June",
        7: "July",
        8: "August",
        9: "September",
        10: "October",
        11: "November",
        12: "December"
    }
    print switcher.get(argument, "Invalid month")
Enter fullscreen mode Exit fullscreen mode

😹😹😹😹😹

Collapse
bloodgain profile image
Cliff • Edited

This has always been a weird one for me. I get why maybe you wouldn't bother doing it up front, since you can just use if/else, but it's such a common pattern that pops up...

Definitely a good example of your point in Python, though to be fair until recently they always admitted it was a dictatorship. And I think most of us Pythonistas will readily admit that it's kind of a cult, but it's a nice cult to be in! 😁