468,288 Members | 1,985 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,288 developers. It's quick & easy.

RE: How to get all the variables in a python shell

Hi, thank your for your reply. I will try iPython.

I did try sage for a while, but I found it quite heavy, and I'm not sure
whether it's easy to expand like python or not. New libraries can be
easily imported in python, and those libraries could be build in almost
any popular computer
language. Can sage do that?

The reason why I want to work on this is the same with you. I'm an
automotive engineer. What I need is a powerful
yet light-weight computation software, which can help me in analyzing
datas on the engine test bench. Matlab is powerful, but it contains so
much stuff that I actually don't need but have to buy, and you know that

it's quite expansive.

So my idea is to build a GUI with python first, and then intergrate as
many exsiting computation libraries as possible. There also has to be a
plotting app, which is quite important and need to think about. I did
try Gnuplot-python combination and matplotlib, but found both terrible
inferior to Matlab plotting functionality. Do you know any plotting
programs written in
-----Original Message-----
From: py**************************************@python.or g
[mailto:py**************************************@py thon.org] On Behalf
Of ca**@mailinator.com
Sent: Friday, May 30, 2008 9:55 PM
To: py*********@python.org
Subject: Re: How to get all the variables in a python shell
Your project interests me. Actually I was thinking about doing the
same. I hadn't worked on it at all, but I though about it and had the
idea about reading the session namespace directly, which I though would
be stored in the __dict__ attribute of something.

After reading your post, I have been trying a little bit, and I have
found a way to do it with ipython. If you open an ipython console, press
_ then hit TAB, you'll see it stores some useful information, including
all input, all output, and after some searching, a dictionary matching
all variables to its values.


There is a little extra stuff in there that you don't want, but that
can be easily filtered (the extra stuff is either 'In', 'Out', 'help' or
starts with '_'). I've tried it, and you can change the value in that
dict to alter the value of the real variable. Say you have a variable

print test #prints 5

If I get it right, python is a dynamic language, and you won't break
things by messing around with its inner stuff like this, but you better
check it.

Is this what you had in mind?

Jun 27 '08 #1
1 995

Have you seen this page?
On watching this, I wouldn't say matplotlib is inferior to matlab
plotting. Also, I don't know what they use in sage, but they have 3D
plots of surfaces that you can rotate with the mouse.
Do as you like, but if you want to "intergrate as many exsiting
computation libraries as possible" you may end up doing something too
similar to sage. I wouldn't want to go on such a trip alone, so even
if sage is not exactly what I would do, I will probably work with
them. Their client-server approach should make it easy to work on a
cool interface without messing too much with their code. It's true,
you'll have to carry with you a lot of symbolic computation tools that
may be you don't need as an engineer, but is it that important? The
client-server approach has other advantages: if you have a very
lightweight computer (like EEE), you can place the server at home and
the lightweight computer is enough to have a full scientific
environment outdoors. And yes, I'm pretty sure you can call any
library from within sage the same way you'd do it from python.
Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Logan | last post: by
20 posts views Thread by Matthew Thorley | last post: by
3 posts views Thread by Greg Lindstrom | last post: by
3 posts views Thread by David Durkee | last post: by
2 posts views Thread by Xah Lee | last post: by
30 posts views Thread by bblais | last post: by
15 posts views Thread by lixinyi.23 | last post: by
1 post views Thread by Fredrik Lundh | last post: by
2 posts views Thread by MrBee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.