-
Rather than raising an exception and pulling the frame from the traceback, you can use sys._getframe(depth) (not sure when it was introduced - presumably after 1997).
-
See this recipe :
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66062
If your code is for a Python version >= 2.1, using
sys._getframe() is a much better approach than
raising an exception.
Cheers,
Matias.