5 ms·
Is this common in python to declare local variables as fake parameters? The downside is obvious: it clutters the function interface with red herrings. What is t
by tasty_freeze 3y ago
Is this common in python to declare local variables as fake parameters? The downside is obvious: it clutters the function interface with red herrings. What is the upside?
- 1024core 3y agoThe upside is that if you wanted a different "iter", "a" or "b", you could just specify it in the arguments.
- tasty_freeze 3y agoThe iter part I get, but I don't see how the caller can affect a or b. Whatever value supplied for a or b will be replaced by values in dependent of a and b during the loop. a is a function of S and x (which initially is a function of S) and b is a function of x and the just revised value for a.
- photochemsyn 3y agoNo, it was just to shorten the code block length for the comment section (for a and b, iters makes more sense as one might want to allow the caller to change that) :)