Skip to main content
added 2 characters in body
Source Link
JL Peyret
  • 12.2k
  • 4
  • 67
  • 96

Shorter version:

import inspect def f1(): f2() def f2(): print ('caller name:', inspect.stack()[1][3]) f1() 

(with thanks to @Alex, and Stefaan Lippen)

Shorter version:

import inspect def f1(): f2() def f2(): print 'caller name:', inspect.stack()[1][3] f1() 

(with thanks to @Alex, and Stefaan Lippen)

Shorter version:

import inspect def f1(): f2() def f2(): print ('caller name:', inspect.stack()[1][3]) f1() 

(with thanks to @Alex, and Stefaan Lippen)

Source Link
Todd Owen
  • 16.3k
  • 8
  • 57
  • 54

Shorter version:

import inspect def f1(): f2() def f2(): print 'caller name:', inspect.stack()[1][3] f1() 

(with thanks to @Alex, and Stefaan Lippen)