You always call all these functions when building a dictionary. This has nothing to do with classes.
d = {'foo': bar()}
bar
, d['foo']
. , switch
; , switch
.
, :
arg = {
'1': 'I am case 1',
'2': 'I am case 2',
'3': 'I am case 3',
}.get(case, 'default')
func(arg)
, , , :
{'1': lambda: func('I am case 1'), ...}.get(...)()
, :
from functools import partial
{'1': partial(func, 'I am case 1'), ...}.get(...)()