On Jul 27, 6:01 pm, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Fri, 2007-07-27 at 20:46 +0000, André wrote: > > I want to give a user the possibility of "restarting" an interactive > > session, by removing all the objects defined by her since the > > beginning. The way I make this possible is by having a "function" > > that can be called during the interactive session using locals() as an > > argument, as follows: > > > restart(locals()) > > > It works. However, I would like to make this "friendlier", i.e. > > requiring the user to simply type > > > restart() > > > and have the code extract out the value of locals() of the "parent" > > namespace. I thought it might be possible using sys._getframe, but I > > have not been able to figure out why. > > inspect.currentframe(1).f_locals > > The same caveats for locals() apply here: Modifications to this > dictionary may or may not be visible to the caller. > > HTH, > > -- > Carsten Haesehttp://informixdb.sourceforge.net
Thanks, it worked! André -- http://mail.python.org/mailman/listinfo/python-list