Name of function caller

John Machin sjmachin at lexicon.net
Tue May 15 19:48:18 EDT 2007


On May 16, 8:56 am, HMS Surprise <j... at datavoiceint.com> wrote:
> On May 15, 5:13 pm, Paul McGuire <p... at austin.rr.com> wrote:
>
> > On May 15, 4:59 pm, HMS Surprise <j... at datavoiceint.com> wrote:
>
> > > Is there a way that a function may access the doc string or func_name
> > > of the caller?
>
> > > Thanks,
>
> > > jvh
>
> > Yes.  The inspect module allows you to look up the call stack for
> > information on the caller, the caller's caller, local vars, etc.
>
> > -- Paul
>
> Thanks Paul.
>
> Running jython 2.2. No module named inspect or cInspect
>
> drat...

According to the current docs, inspect was new in Python 2.1. You've
been in more strife than Paris Hilton recently and it's hard to keep
track, but IIRC you're the guy with the badly-stuffed sys.path ...
have a look on your disk(s). OTOH maybe inspect depends on the
internal call stack implementation --- in that case you would need to
ask on the jython mailing-list.

HTH,
John





More information about the Python-list mailing list