[IPython-dev] Closing in on 0.11? We need some review/feedback help

Fernando Perez fperez.net at gmail.com
Sun Jan 17 20:27:14 EST 2010


On Sat, Jan 16, 2010 at 9:48 PM, Gökhan Sever <gokhansever at gmail.com> wrote:
> 1- Look in the history in the reverse order to obtain the latest entry of
> the same variable assignment. Each element listed in the history output is a
> separate string pulled out of a list.
>
> 2- Compare the "string".split("=")[0] with each variable name in %whos call.
>
> 3-Write the output in the 4th column of the whos listing (using a one of the
> names: "Assignment", "Command", "History"):
>
> Variable   Type    Data/Info    Assignment
> --------------------------------------------------
> a              int        5               a=5
> n              float     0.0             n = math.sin(0)
>
> Data/Info column usually produces longer lines this might cause some ugly
> looking output.
>
> Could I get some suggestions?

Well, sounds like you have a plan, go ahead and implement it :)

Some pointers:

- get the global ipython object via get_ipython()
- its .user_ns is your user namespace.
- in there, the 'In' variable contains your inputs.

I'd just add this as a normal function initially loaded in your
startup file.  Once it's working the way you want it, you just need a
few lines to expose it as a magic for convenience.

Cheers,
f



More information about the IPython-dev mailing list