I am planning to write a routine to achieve below functionality: According to the "method", and "before" and "after", compute the expense. Not sure if passing a json as an input of the function is a good practice? Does it mean the function is trying to achieve too much? When I assign a default value to "target", Pycharm gives warning "mutable object as default argument".
def assign_expense(target={'fly':{'before':'US', 'after':'JP'}, 'walk':{'before':'blockA', 'after':'blockB'})
method, before, after = abstract_param_from_json(target)
if method='fly':
if before=='US', after=='JP':
func_fly_US_JP
elif before=='MXN', after=='CAD':
func_fly_MX_CAD
if method='walk':
if before=='blockA', after=='blockB':
func_A_to_B
if before=='blockC', after=='blockZ':
func_C_to_Z