Re: Safe-Python?

Donald Beaudry (don@vicorp.com)
Wed, 28 Sep 94 09:31:44 EDT

>>>>> On Tue, 27 Sep 94 16:59:59 PDT, lance@fox.com said:
> One of the biggest problems with making a safe-python as far as I see it
> is that there is only one interpreter with only one main name space.

> The ONLY thing that I liked about Tcl is that you can create new interpreter
> instances and add your own functions to it.

> What I propose for a safe-python will take some work, but I do not think
> it is beyond what needs to be done.
> I propose that python is modified to use Interpreter Objects.

This issue was discussed briefly well over a year ago. I think making
the necessary changes is a good idea, but since Guido has already
accused me of trying to rewrite the entire Python object system (quite
possibly a justifiable accusation) I think I need to be careful
here.

The main problem, as I see it, is that many modules use static
variables to hold state information. These modules would have to be
modified so that the state information can be kept on a per
interpreter basis. One idea, that I happen like, is to make a module
more like a built-in class. Then each time an interpreter imports a
module a new instance of the module can be created for use by that
interpreter alone. This could be a lot of work.

In addition to helping to create a safe Python, I think that there are
many other uses for a change like this. Consider a Python development
environment written in Python. It would be real nice to execute the
code being developed in a seperate interpreter without having to spawn
a new process. Executing this code in the same interpreter as the
development environment could lead to inadvertent changes there.

-- 
Donald Beaudry                                V.I. Corporation
don@vicorp.com                                Northampton, MA 01060