Yes, once I used it to print an 'enhanced stack backtrace'. Each time the
site engine was crashing (not web2py, long ago) the stack trace was emailed
to me along with all variables values that existed at all levels of the
trace.

On Fri, Aug 27, 2010 at 6:53 AM, GoldenTiger <goldenboy...@gmail.com> wrote:

> do you refer to module inspect? it's great for introspecting on live
> objects and their source code
>
> On 27 ago, 03:44, mdipierro <mdipie...@cs.depaul.edu> wrote:
> > I discovered this:
> >
> > def f(name):
> >     import inspect
> >     c_frame = inspect.getouterframes(inspect.currentframe(), 1)[1][0]
> >     c_args, c_varargs, c_varkw, c_locals =
> > inspect.getargvalues(c_frame)
> >     d = dict(c_locals)
> >     return d[name]
> >
> > def g():
> >     a=5
> >     print f('a')
> >
> > g() # prints 5
>

Reply via email to