Re:Five-minute Multimethods in Python
by datashaman on Wednesday December 07, 2011 @11:16AM
(#3324388)
I like to use defaultdict for this. A strategy dictionary, with a default strategy.
dispatch = defaultdict(default_stategy)
dispatch['one'] = new_strategy
print dispatch['two'] => default_strategy.
Beats case statements and elif chains.
That's totally possible in Python, too, but I don't really ever see it done.