Commits

Anonymous committed c17806a

utils: Re-added caller() from 764

Comments (0)

Files changed (1)

 		if max is None or item > max:
 			max = item
 	return min, max
+
+def caller(n=1):
+	"""caller(n=1) -> str
+
+	Return the name of the calling function.
+	If n is specified, return the n'th function
+	in the stack.
+	"""
+
+	from traceback import extract_stack
+	stack = extract_stack()
+	return stack[-n-2][2]