How to get all the variables in a python shell

A.T.Hofkamp hat at se-162.se.wtb.tue.nl
Thu May 29 03:22:29 EDT 2008


On 2008-05-29, lixinyi.23 at gmail.com <lixinyi.23 at gmail.com> wrote:
> Hi!
>
> I'm currently working on a scientific computation software built in
> python.
> What I want to implement is a Matlab style command window <->
> workspace interaction.

ok, although I personally favor the style of writing and running a
script/program, since it scales much better (you can easier automate steps),
and it is much easier reproducible (something you probably want in scientific
software) and storable (in a VCS).

> For example, you type 'a=1' in the command window, and you see a list
> item named 'a' in the workspace.
> You double click the icon of the item, and you see its value. You can
> modify the value of the list item,
> 1 -> 100 etc,  after which if you go back to the command window and
> type 'a'  and press enter, you see that
> varable a's value has been changed to 100.

I do hope you have made a fair estimate of the amount of work that it costs to
change the value of a variable in this way.

I would propose to simply use the interactive Python prompt. It doesn't give
you popup icons for clicking, but you do get the entire Python interpreter, and
all its libraries for free.

The Python library has a frame work for customizing the interpreter. Have a
look at 'cmd' module.

> So my question is : if you have two DOS command windows running under
> WINDOWS OS, how can you make them share the same internal variable
> buffer? Or is there any easier way to implement such kind of
> interaction?

Now you have lost me. One window is not enough for interaction?

Obviously, you'll need to have a common interpreter/storage backend. One
solution may be to have a common execution back-end, and for each window a
'frontend' which passes commands entered to the back-end, and echoes results
from the back-end to the terminal.

> Maybe I could just build a small database to store all the values and
> access them from both programs, but chances are sometimes I have to
> deal with big arrays, and they will eat extra memory if I keep them in

They eat memory when you keep them in a data base? It seems, you are making
assumptions about implementations here without telling them.
(ie pick a data base that uses a disk, and your problem is solved. Why is that
not an option?)

Sincerely,
Albert




More information about the Python-list mailing list