Eval the caller within a method?

Olivier Dagenais olivierS.dagenaisP at canadaA.comM
Sat Oct 21 09:22:20 EDT 2000


If you're lucky enough to only have Python code calling Python code, take a
look at watch.py that I posted yesterday.  It uses the traceback module to
look at the stack and extract some neat information from it.  If you want to
log some stuff, it would probably be a perfect replacement to whatever you
are using...

--
----------------------------------------------------------------------
Olivier A. Dagenais - Software Architect and Developer
"Someone called 'Type your name here' is impersonating me on the
internet and is posting exactly the same things I am posting!"


"Franz GEIGER" <fgeiger at datec.at> wrote in message
news:8srn4j$lr8$1 at newsreaderm1.core.theplanet.net...
> I wonder if in Python there is a possibility to evaluate the method which
> called a method within that method like it is in Perl.
>
> This would prevent me from having to write code like
> logIt = TLog("Callers name")
> logIt("Some diagnostics");
>
> (printing:
> "'Callers name': Entered. "
> "Callers name': Some diagnostics"
> )
>
> because TLog() could figure out which method called it.
>
> Any ideas?
>
> Best regards
> Franz GEIGER
>
>
>





More information about the Python-list mailing list