I wanted to code a function that returns the number of days of a given month on a given year (for Project Euler 19). Of course it's very easy to do this with if statements but, for the sheer pleasure of seeing such a way work in Python, I decided to use a dictionary with lambda-functions as values:
This works perfectly.
Now I'm wondering whether there are factual reasons why this would not be recommended, compared to for example a simple function with if statements.
Thanks in advance for your answers.
View on Stack Overflow
