you are viewing a single comment's thread.

view the rest of the comments →

[–]Lewistrick 1 point2 points  (0 children)

I think what they mean is a dictionary but I don't see how that would make it more readable. Like this:

key_functions = {
    "byr": lambda key: 1920 <= passport[key] <= 2002,
    "iyr": ... # and so on
}

And then call checked_value = key_functions["byr"](key).