[IPython-User] Populating variables in current frame automatically?
Francesc Alted
faltet@pytables....
Tue Sep 21 10:12:28 CDT 2010
Hi,
I'd like to know if there is a good way to automatically import items in
a dictionary as variables into an IPython shell. For example, I'd like
to do something like:
In [1]: mydict = {'p1': 1, 'p2':2}
In [2]: import sys
In [3]: frame= sys._getframe(0)
In [4]: frame.f_locals.update(mydict)
In [5]: p1
Out[5]: 1
In [6]: p2
Out[6]: 2
but seems a bit ugly to my eyes :-/
I don't want to use the %store magic because I may want to use different
(potentially pickled) dictionaries in order to populate my variables.
Keep up the good work. I use IPython all the time and it is really
great!
--
Francesc Alted
More information about the IPython-User
mailing list