As a programmer, I have always wondered whether it is preferable to write (a) short modular functions that are each stored in their own script (i.e., file) or (b) long comprehensive scripts that contain all of their relevant functions.
For example, if I code a data analysis stream that includes a variety of operations performed on the same data (e.g., data cleaning, feature selection, clustering, supervised learning, etc.), should I write a single file even if it runs for hundreds of lines?
I have heard many opinions on the matter and I wonder what this community thinks. I understand that the answer may depend on the type of project, but, if this is the case, then it would be great to hear your thoughts on what factors one should consider in deciding between options (a) and (b).
I am currently coding in Python and I've wondered whether Python programmers have a preference to multiple functions in the same file or one file per function, but I imagine that this question is broader and applies to all programming languages.