That's exactly what I was thinking. The difficulty is that in Python is that lambda functions can have expression bodies which makes it a pain in the ass. So you'd have to define the functions, then create the lookup dict.