Go to the RMD, PDF, or HTML version of this file. Go back to Python Code Examples Repository (bookdown site) or the pyfan Package (API).
There is a dictionary of parameter values, decide on the values for several keys based on a parameter using single line simple operations.
ls_model_assumption = ['', 'ITG', 'GE', 'ITG_GE']
for model_assumption in ls_model_assumption:
dc_invoke_main_args_default = \
{'speckey': 'b_ge_s_t_bis' if 'GE' in model_assumption else 'ng_s_t',
'ge': ('GE' in model_assumption)}
print(f'{dc_invoke_main_args_default=}')
## dc_invoke_main_args_default={'speckey': 'ng_s_t', 'ge': False}
## dc_invoke_main_args_default={'speckey': 'ng_s_t', 'ge': False}
## dc_invoke_main_args_default={'speckey': 'b_ge_s_t_bis', 'ge': True}
## dc_invoke_main_args_default={'speckey': 'b_ge_s_t_bis', 'ge': True}