Horje
python get previous method name Code Example
python get previous method name
import inspect
# functions
def whoami():
    return inspect.stack()[1][3]
def whosdaddy():
    return inspect.stack()[2][3]
def foo():
    print "hello, I'm %s, daddy is %s" % (whoami(), whosdaddy())
    bar()
def bar():
    print "hello, I'm %s, daddy is %s" % (whoami(), whosdaddy())
johny = bar
# call them!
foo()
bar()
johny()




Python

Related
normalize image in cv2 Code Example normalize image in cv2 Code Example
difference between object and class in python Code Example difference between object and class in python Code Example
Which function is used to write all the characters? Code Example Which function is used to write all the characters? Code Example
modwt python github code Code Example modwt python github code Code Example
<function chr(i, /)> error in python Code Example <function chr(i, /)> error in python Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8