Re: How can I know the name of caller

2007-06-20 Thread billiejoex
On 20 Giu, 06:52, John Nagle [EMAIL PROTECTED] wrote: billiejoex wrote: Hi there, unfortunately, I'm compelled to apply a sort of monkey patching at the code of an existing libreary that I can't modify directly. ... ...(if it is possible) how can I get, from method called, the name of

How can I know the name of caller

2007-06-19 Thread billiejoex
Hi there, unfortunately, I'm compelled to apply a sort of monkey patching at the code of an existing libreary that I can't modify directly. Here's my question Having such code: class test: def caller(self): self.b() def called(self): pass ...(if it is possible) how can

Re: How can I know the name of caller

2007-06-19 Thread Stefan Sonnenberg-Carstens
billiejoex schrieb: Hi there, unfortunately, I'm compelled to apply a sort of monkey patching at the code of an existing libreary that I can't modify directly. Here's my question Having such code: class test: def caller(self): self.b() def called(self): pass

Re: How can I know the name of caller

2007-06-19 Thread zacherates
...(if it is possible) how can I get, from method called, the name of function/method that called it (in this case caller)? The traceback module will give you access to the call stack. import traceback def foo(): ... return traceback.extract_stack() ... def bar(): ... return foo()

Re: How can I know the name of caller

2007-06-19 Thread billiejoex
On 19 Giu, 22:50, Stefan Sonnenberg-Carstens [EMAIL PROTECTED] wrote: billiejoex schrieb: Hi there, unfortunately, I'm compelled to apply a sort of monkey patching at the code of an existing libreary that I can't modify directly. Here's my question Having such code: class test:

Re: How can I know the name of caller

2007-06-19 Thread gerrit . holl
On Jun 19, 10:50 pm, Stefan Sonnenberg-Carstens [EMAIL PROTECTED] wrote: billiejoex schrieb: ...(if it is possible) how can I get, from method called, the name of function/method that called it (in this case caller)? inspect.stack is your friend ;-) If you start doing such things on a

Re: How can I know the name of caller

2007-06-19 Thread Jay Loden
billiejoex wrote: Hi there, unfortunately, I'm compelled to apply a sort of monkey patching at the code of an existing libreary that I can't modify directly. Here's my question Having such code: class test: def caller(self): self.b() def called(self): pass

Re: How can I know the name of caller

2007-06-19 Thread Jay Loden
billiejoex wrote: Hi there, unfortunately, I'm compelled to apply a sort of monkey patching at the code of an existing libreary that I can't modify directly. Here's my question Having such code: class test: def caller(self): self.b() def called(self): pass

Re: How can I know the name of caller

2007-06-19 Thread Gabriel Genellina
En Tue, 19 Jun 2007 18:06:40 -0300, billiejoex [EMAIL PROTECTED] escribió: On 19 Giu, 22:50, Stefan Sonnenberg-Carstens [EMAIL PROTECTED] wrote: billiejoex schrieb: ...(if it is possible) how can I get, from method called, the name of function/method that called it (in this case caller)?

Re: How can I know the name of caller

2007-06-19 Thread John Nagle
billiejoex wrote: Hi there, unfortunately, I'm compelled to apply a sort of monkey patching at the code of an existing libreary that I can't modify directly. ... ...(if it is possible) how can I get, from method called, the name of function/method that called it (in this case caller)?