How can I get the function's caller?

Michele Simionato michele.simionato at gmail.com
Thu Sep 14 07:00:37 EDT 2006


David wrote:
> Il Wed, 13 Sep 2006 07:34:45 +0100, Steve Holden ha scritto:
>
> > What do you need this name for, just as a materr of interest? There are
> > ways of manipulating the stack frames, but they'll be slow and possibly
> > unreliable.
> I am writing a big (for me) program and it would be helpful to have a dummy
> function like this:
>
> def function_A_subfunction_B(self, ....)
> 	dummy()
>
> that display a standard message like this:
>
> "Dummy: 'function_A_subfunction_B' in module 'module' is not defined yet"
>
> regards
> David

Check also the warnings module (it will give you also line number
information for free).

            Michele Simionato




More information about the Python-list mailing list