4 ms·
When you're processing a lot of data, it can be expensive to keep re-running your whole script every time you make a change. The notebook keeps the results of y
by daveFNbuck 8y ago
When you're processing a lot of data, it can be expensive to keep re-running your whole script every time you make a change. The notebook keeps the results of your earlier steps in memory when you want to change and re-run a later step.
This is a trade-off between how much code you're writing and how much data you're processing. If you're writing maybe 20 lines of code but you have enough input that it takes several minutes to run, the notebook becomes a clear win for your development process.
- short_sells_poo 8y agoSo does the standard terminal repl in python. You can achieve the same workflow with having a plain old python file, and then just use your favorite editor's "Send block of code to console" function. This way, you retain your editor's functionality while you can work just as interactively as with a notebook.
- mimischi 8y agoBut then there are plotting and interactive widgets in the notebook.
- agibsonccc 8y agoYou can generally persist the results your self to disk though. Especially since a lot of things end up being numpy arrays. So you run 1 script that saves all the results, and another that loads it and runs just the part of your workflow you want. Bonus: it's persisted to disk on top of that! I know things get more complicated than that, but I'd say the compelling use case for notebooks isn't the state saving but more the whole package in one place (state persistence,visualization, interactive repl,..)
- daveFNbuck 8y agoYeah, I often do that myself, but it's not as convenient for a quick one-off data exploration.