DEV Community

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

ginsburgnm profile image
Noah Ginsburg

This is actually (almost) exactly how I would handle it in Python. Why? Well switch statements don't actually exist in Python anyway, so to get the same efficiency you use a dictionary (map) lookup.