filename of calling function?
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Sat Nov 28 20:05:22 EST 2009
On Sat, 28 Nov 2009 08:19:02 -0800, Phlip wrote:
> Consider these two python modules:
>
> aa.py
>
> def a():
> print '?'
>
> bb.py
> import aa
>
> def bb():
> aa.a()
>
> bb()
>
> How do I make the print line emit the filename of bb.py? (It could be
> anything.)
See the inspect module:
http://stefaanlippens.net/python_inspect
--
Steven
More information about the Python-list
mailing list