function call

kyosohma at gmail.com kyosohma at gmail.com
Tue Sep 4 16:35:38 EDT 2007


On Sep 4, 3:17 pm, ianaré <ian... at gmail.com> wrote:
> Hey all,
>
> Is there a way of printing out how a function was called? In other
> words if I do the following:
>
> def someFunction(self):
>     self.someOtherFunction(var1, var2)
>
> I would get something like "someOtherFunction: called by:
> someFunction, args are: var1, var2"
>
> Thanks in advance
>
> - ianaré

I think you can use __name__, but I'm not sure how to apply it here.
Read up on Python's introspection tools:

http://www.ibm.com/developerworks/library/l-pyint.html

Mike




More information about the Python-list mailing list