1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
import inspect

class Foo:
	def __init__(self, a, b):
		frame = inspect.currentframe().f_back
		code_context = inspect.getframeinfo(frame).code_context[0]
		print(code_context)

bar = Foo(1,
	2)

# output:
# 	2)
# wanted:
# bar = Foo(1,
# 	2)

This paste never expires. View raw. Pasted through import.