Re: [Python-ideas] [Python-Dev] Persistent Python - a la Smalltalk
[BCC python-dev, +python-ideas]
Funny you should mention this. ABC, Python's predecessor, worked like
this. However, it didn't work out very well. So, I'd say you're about
30 years too late with your idea... :-(
--Guido
On Sat, Sep 17, 2011 at 8:05 AM, Albert Zeyer
Hi,
I was thinking about a persistent Python interpreter system. I.e. you start a Python interpreter instance and you load and create all your objects, classes and code in there (or load it in there from other files).
The basic idea is that you wont restart your Python script, you would always modify it on-the-fly. Or a bit less extreme: You would at least have the possibility with this to do this (like just doing minor changes). Also, if your PC halts for whatever reason, you can continue your Python script after a restart.
This goes along my other recent proposal to store the AST of statements in the related code objects (http://thread.gmane.org/gmane.comp.python.devel/126754). An internal editor could then edit this AST and recompile the code object.
For the persistance, there would be an image file containing all the Python objects.
All in all, much like most Smalltalk systems.
---
Has anyone done something like this already?
---
There are a few implementation details which are not trivial and there doesn't seem to be straight forward solutions, e.g. most generally:
* How to implement the persistance? * How to handle image compatibility between CPython updates? Even possible?
Regards, Albert _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org
-- --Guido van Rossum (python.org/~guido)
On Sun, Sep 18, 2011 at 1:17 AM, Guido van Rossum
[BCC python-dev, +python-ideas]
Funny you should mention this. ABC, Python's predecessor, worked like this. However, it didn't work out very well. So, I'd say you're about 30 years too late with your idea... :-(
Given the challenges of just getting pickle to work properly for explicit state transfer, I shudder at the prospect of trying to implicitly freeze the entire interpreter state... (and that's even before we get into the problem of programmers responding with "What do you mean restarting my script doesn't reinitialise all the state?") Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia
Den 17.09.2011 17:22, skrev Nick Coghlan:
Given the challenges of just getting pickle to work properly for explicit state transfer, I shudder at the prospect of trying to implicitly freeze the entire interpreter state... (and that's even before we get into the problem of programmers responding with "What do you mean restarting my script doesn't reinitialise all the state?") Cheers, Nick.
I am not sure what he means. But if he e.g. wants to save an interactive session with the command prompt, a la Matlab, then ipython will do what he wants. Suspending and restarting a process on Unix is of course as easy as $ kill -s STOP [pid] $ kill -s CONT [pid] I don't know of any Windows equivalent. But virtual computers (e.g. VirtualBox, VMware) can be paused and restarted. Sturla
On Sat, Sep 17, 2011 at 08:36:35PM +0200, Sturla Molden wrote:
Den 17.09.2011 17:22, skrev Nick Coghlan:
Given the challenges of just getting pickle to work properly for explicit state transfer, I shudder at the prospect of trying to implicitly freeze the entire interpreter state... (and that's even before we get into the problem of programmers responding with "What do you mean restarting my script doesn't reinitialise all the state?") Cheers, Nick.
I am not sure what he means. But if he e.g. wants to save an interactive session with the command prompt, a la Matlab, then ipython will do what he wants.
Suspending and restarting a process on Unix is of course as easy as
$ kill -s STOP [pid] $ kill -s CONT [pid]
I don't know of any Windows equivalent. But virtual computers (e.g. VirtualBox, VMware) can be paused and restarted.
The OP wants something like Emacs/TeX/Perl undump/unexec. Oleg. -- Oleg Broytman http://phdru.name/ phd@phdru.name Programmers don't die, they just GOSUB without RETURN.
On 09/17/2011 09:35 PM, Oleg Broytman wrote:
On Sat, Sep 17, 2011 at 08:36:35PM +0200, Sturla Molden wrote:
Den 17.09.2011 17:22, skrev Nick Coghlan:
Given the challenges of just getting pickle to work properly for explicit state transfer, I shudder at the prospect of trying to implicitly freeze the entire interpreter state... (and that's even before we get into the problem of programmers responding with "What do you mean restarting my script doesn't reinitialise all the state?") Cheers, Nick.
I am not sure what he means. But if he e.g. wants to save an interactive session with the command prompt, a la Matlab, then ipython will do what he wants.
Suspending and restarting a process on Unix is of course as easy as
$ kill -s STOP [pid] $ kill -s CONT [pid]
I don't know of any Windows equivalent. But virtual computers (e.g. VirtualBox, VMware) can be paused and restarted.
The OP wants something like Emacs/TeX/Perl undump/unexec.
Oleg.
I can't imagine how it would work with any bindings (e.g. PyQt) or with opened handles to files/devices or even network sockets. It would only make sense for a strictly controlled environment where these things just don't exist and not for a full python installation. -panzi
participants (5)
-
Guido van Rossum
-
Mathias Panzenböck
-
Nick Coghlan
-
Oleg Broytman
-
Sturla Molden