khanna-lab / cadre

Other
0 stars 0 forks source link

Note to self: Eventually we want to convert the `load_params` module in to a function #29

Closed khanna7 closed 2 years ago

khanna7 commented 2 years ago

https://github.com/khanna7/cadre/blob/1727cbf0d3f0980f1e94c3c6308b2214c01d1d76/python/pycadre/load_params.py#L3

Daniel suggests wrapping this code in a function and producing a global params_list variable, like here:

def init_age_range_manager():
    global age_range_manager
    age_range_manager = AgeRangeManager()
    return age_range_manager
khanna7 commented 2 years ago

Use global variables carefully though because they can show up anywhere and interact with the code. Having inputs (like arguments) and outputs (return statements) is better.

khanna7 commented 2 years ago

Couldn't really get this to work, without changing the import statements and updating the params_list in every scope where it is called.

khanna7 commented 2 years ago

Done with Daniel's help: https://github.com/khanna7/cadre/commit/f84dc8f185832d9d52cce94df1f0d5d896caab2f