You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Something brought up by @samanthalh -- When one is developing notebook for users and find oneself in a situation where one needs to copy and paste the same code with slight variations (e.g., plotting results of subsequent tweakreg runs on the same dataset), is it better to:
Brute force copy and paste; OR
Write a function of the repeated code and then call it with different inputs where they vary?
Brute force way is more tedious and provides clarity and possibly is resistant to out-of-order cell runs in some cases. A function might be more elegant and reduce future maintenance but user needs to scroll up to see what happens in the function, and the cell with the function needs to be run before all the other stuff.
Is a guide line for such a thing within scope of this document?
The text was updated successfully, but these errors were encountered:
It's a common quandary. My preference would be to define each function in a cell of its own with if it's more than a few lines long, since otherwise all that repeated code can just obfuscate the examples being communicated in the later cells. As a matter of style, I'd suggest these be collected in their own section early in the notebook, and descriptions of what they do in separate markdown cells.
Something brought up by @samanthalh -- When one is developing notebook for users and find oneself in a situation where one needs to copy and paste the same code with slight variations (e.g., plotting results of subsequent
tweakreg
runs on the same dataset), is it better to:Brute force way is more tedious and provides clarity and possibly is resistant to out-of-order cell runs in some cases. A function might be more elegant and reduce future maintenance but user needs to scroll up to see what happens in the function, and the cell with the function needs to be run before all the other stuff.
Is a guide line for such a thing within scope of this document?
The text was updated successfully, but these errors were encountered: