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
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
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
...(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()
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:
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
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
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
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)?
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)?
10 matches
Mail list logo