5 ms·
One thing that I would love in python is some sort of snapshotting, Like “this is my global state” - the entire state of the python process, all objects, etc.
by malux85 8y ago
One thing that I would love in python is some sort of snapshotting,
Like “this is my global state” - the entire state of the python process, all objects, etc.
Then I change a variable and that creates a new state. We have this now.
What I want is a rewind button, so I can go back to the previous state (quickly preferably) like a time travelling debugger.
Someone build this, I’ll pay for it (and I’m sure others would too)
I know there’d be some problems with external changes (API calls altering external system, writing to files, etc) that a time travelling debugger might not be able to reverse, but even so, I would live with this limitation happily if such a tool existed
- detaro 8y agoA basic way of getting that on Unix systems is forking - you get a copy of the process with the same memory state, and likely relatively small interfaces would suffice to manage which process is currently receiving input from e.g. a REPL. (Sockets, open files, ... are more complex, but I guess many REPL workflows could do without that). Sadly you can't easily save much memory for the snapshots from copy-on-write (which otherwise is a neat trick with forking to keep old state) due to the way Python manages memory, at least not without modifying the interpreter.
- CMCDragonkai 8y agoInteresting COW for whole process images and a tree like interface to jump between them. Could work if well if the process image itself had structured interfaces for everything important. Otherwise you'd end up with black box images everywhere.
- thomasballinger 8y agoIf anyone wants to walk through these ideas more slowly I write about them in http://ballingt.com/interactive-interpreter-undo http://ballingt.com/interactive-interpreter-undo and implement this in https://github.com/thomasballinger/rlundo https://github.com/thomasballinger/rlundo but as you say, eventually decided I had to implement an interpreter for which serialization of state was more efficient and all external resources had amenable interfaces http://dalsegno.ballingt.com/ http://dalsegno.ballingt.com/
- mpweiher 8y ago> snapshotting ... entire state of the python process, all objects, etc. Someone else in this thread mentioned Smalltalk: this is exactly what a Smalltalk image gives you. The image is everything, all your objects, code, temporary, everything. And at any time you can do "save" or even "save as" to persist a copy. And there are variants that can work with Python code as well. http://squeak.org/ http://squeak.org/
- TuringTest 8y agoIt's a shame that Smalltalk never gained traction as a system language, and the C/Unix approach took over enterprise-grade development. I wonder what software engineering would look like if all the decades-long advancement of tools for stabilization and deployment of code had been researched over platforms that combined system and application code, like Smalltalk did. Instead, we consider both layers as isolated from each other. A lot of work over virtualization and containers seem to be used as a workaround for not having this integrated approach as part of the platform design.
- scroot 8y agoIt could still work really well as the systems environment and language for a personal computing device. One needs to build the proper abstractions and DSLs on top of it, of course, but it would be a much more conducive environment to "literate computing," if that's the goal (and I think it should be).
- TuringTest 8y agoI think a lot of people reading this thread will agree :-) It is definitely an approach more apt to personal computing than to industrial engineering, at least with the level of maturity of the tools available today. The increased ease of use of these environments may be a nice-to-have for professional developers, but they are essential for non-developers.
- solomatov 8y agoIf you want snapshotting, take a look at http://datalore.io/ http://datalore.io/ It stores snapshots between cells, and can incrementally recalculate only what's needed.
- heavyset_go 8y agoI believe IPython cells keep their state throughout execution of the notebook.