dispatch = defaultdict(default_stategy)
dispatch['one'] = new_strategy
print dispatch['two'] => default_strategy.
Beats case statements and elif chains.
dispatch.get('two', default_strategy)
dispatch = defaultdict(default_stategy)
dispatch['one'] = new_strategy
print dispatch['two'] => default_strategy.
Beats case statements and elif chains.