[python-win32] How to get all the variables in a python shell

Tim Golden mail at timgolden.me.uk
Thu May 29 08:00:59 EDT 2008


Tim Golden wrote:
> lixinyi.23 at gmail.com wrote:
>> 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.
>>
>> 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.
>>
>> 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?
> 
> I stronly suggest you look at IPython [1]. To do what I think
> you're describing, you'd need to hack or reimplement the interpreter.
> And that's what they've done. ISTR that they even have a branch
> which is dealing with parallel instances.

Sorry, having seen Roger D's memcached suggestion, I realise I may
have misinterpreted your requirement. I thought that you wanted
a Python interpreter session to share its objects to another window,
hence my IPython suggestion. If you're writing your own console app
and want to share stuff, then there's any number of IPC possibilities.

Roger's already mentioned memcached which I've no more than a
passing knowledge of. But Pyro [1] is often a good bet for these
things, and the pyprocessing [2] module is gaining a fair bit of
traction at the moment. (To name just two out of many).

TJG

[1] http://pyro.sf.net
[2] http://pyprocessing.berlios.de/




More information about the Python-list mailing list