1. 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).

      posted by xtian at 03:42:37 PM on November 15, 2004  
  2. 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.
      posted by Matias at 02:07:28 AM on November 17, 2004