May-24-2019, 08:37 PM
in a long loop i have a big series of tests, some being multi-level nested if statements that do breaks to break out of that long loop. they are located in the upper part of the loop right after a cloud API operation. i need to duplicate these exact same tests in the lower part of the loop after another slightly different cloud API operation. i can't really put these in a "do twice" loop because of the diversity of surrounding code. so i was thinking of putting them in a function so i have just one copy of that code, but this means passing a long bunch of variables to the function.
i wish there was a way to run some common section of code in the same local context so that it has access to the same local (and global) variable space. it would be nice to have a way, in a function, to make its local (and global) variable space be that of one or two dictionaries passed to the function for such purpose.
can i just put all that code in a triple-quoted literal and use exec() on it, twice?
i wish there was a way to run some common section of code in the same local context so that it has access to the same local (and global) variable space. it would be nice to have a way, in a function, to make its local (and global) variable space be that of one or two dictionaries passed to the function for such purpose.
can i just put all that code in a triple-quoted literal and use exec() on it, twice?
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.