Reputation: 2479
Jupyter notebook has this nice ability to store variable values even when a block of code executed and exited. It is a more powerful version of "break point" in other IDEs. So far, I have noticed some benefits from this jupyter notebook ability:
lengthy_variable_new = lengthy_variable_original.copy()
# do things with lengthy_variable_new
Now, let's imagine a a new ability: "saveState" a script, in which you can save all variables created by the user and all hidden ones, everything that is currently on heap or stack. So you can continue coding after the saveState point but you can restore the saveState point anytime you want.
I understand that python language itself can only pickle things you want. It is handy for some cases but not all.
Is there a proper term describing my "saveState" concept?
Do we have it in pycharm or any other IDEs?
I personally believe there is either a better way, or what I want is very hard to implement so that is almost easier just to re-run the code compared to restoring everything back to memory.
Upvotes: 2
Views: 1852
Reputation: 113
I think your state may refer to a stack frame (more or less).
PyCharm and probably other IDEs have a similar tool. If you are debugging your code and reach a breakpoint you have the possibility to open an interactive ipython console in which you can inspect all current variables in the stack frame, though you cant alter them.
I personally prefer debugging in PyCharm and use Jupyter Notebooks more for interactive exploring data or some new piece of code. It is kind of hart to debug loops in Notebooks and some other things like iterators too.
Upvotes: 1