On 21/03/2019 17:59, Rhodri James wrote:
def process(): if time_to_do_thing1(): thing1(base_env + thing1_env_stuff + env_tweaks) if time_to_do_thing2(): thing2(base_env + thing2_env_stuff + env_tweaks)
...and so on. The current syntax for doing this is a tad verbose:
def process(): if time_to_do_thing1(): env = base_env.copy() env.update(thing1_env_stuff) env.update(env_tweaks) thing1(env) del env if time_to_do_thing2(): env = base_env.copy() env.update(thing2_env_stuff) env.update(env_tweaks) thing2(env) del env
Of course I forgot: def process(): if time_to_do_thing1(): thing1({**base_env, **thing1_env_stuff, **env_tweaks}) if time_to_do_thing2(): thing2({**base_env, **thing2_env_stuff, **env_tweaks}) ...which says something about how memorable that syntax is. -- Rhodri James *-* Kynesim Ltd