Oftentimes, we call functions over a wide range of parameter values, e.g. to generate plots for different scenarios. For multiple parameters, this leads to ugly multi-loops and cumbersome boilerplate. With this snippet it becomes one line.
Let’s say that we have a plotting function
plot and call it for multiple values
c and want to reflect these numbers in the filename of the plot. Then the naive way to do this
is the following:
With the following snippet, we can do the same thing in just one line:
Here’s the snippet: