I use this pattern a lot. It's also nice to be able to do dict.get(key, lambda: raise ValueError(f'no handler for {key}')) to have a nice fallback or raise in a convenient one liner.
That's not at all valid syntax, this does not work.
yeah sorry the 'raise' is not valid in-line I did this from mobile - normally I would define the fallback handler elsewhere and/or place it in the map under a key like 'default'