inspect experiment

import inspect
def call_1():
	sample = inspect.stack(1)[1]
	file_name = sample[1]
	line_num = sample[2]
	method_name = sample[3]
	format_mes = "File:%s Line:%s Method:%s"
	res = format_mes % (file_name, line_num, method_name)
	print res
	

def call_2():
	call_1()
	
def call_3():
	call_2()

#Example
print "--------------------"	
call_2()
print "--------------------"
call_3()
	

Recommended Posts

inspect experiment
svm experiment 1
Laplacian Filter experiment