In line with the concept of modularisation, I try to keep codes that perform a particular operation in one cell. It also helps in tracing errors. When you run a cell, you can quickly see that it is performing its function or not.
You can build upon a block of code in a cell, the exact size of the block depends on the individual.
I believe this question is best answered/learned through your own experience.
Have you met any issues with putting too much code in one cell or across too many cells? ?
If yes what were they? Do you have any code samples?
Then we can discuss how to break it up, or which parts are good to go together.
Else, it’s just a matter of preference.
It’s the same code, runs the same, and gives the same effect (assuming no asynchronous operations), assuming they’re in same order, no matter in one cell or multiple cells.
Convenient alt/shift/ctrl+enter running and also downstream decisions like moving from .ipynb to .py (using %%writefile
) will inform cell splits.
Thank you for taking time to answer my question.