Thanks for the link Jim, I found it quite helpful. The final product of my decorator is:

# @type code org.darkhelm.showsort.server.Code
def tracer(code):
    """
    Simple decorator function that handles identification of recursion and the
    name of the current function to ShowSort. It must have the code parameter
    be set to the Java Code object that will be executing the function.
    """
    import sys

    def wrapAll(func):
        def wrappedFunc(*args, ** kwargs):
            top = sys._getframe(1)

            current = top

            while current.f_back:
                current = current.f_back
                if top.f_code == current.f_code:
                    code.recurse()          # Tell ShowSort that a recursion happened.
                    break

            code.pyFuncName = func.__name__ # Tell ShowSort the name of the function.

            return func(*args, ** kwargs)

        wrappedFunc.__doc__ = func.__doc__

        return wrappedFunc

    return wrapAll

This seems to do the job for me. I guess my problem was I was attempting to make a solution to this outside of Jython, where the solution was simpler inside Jython.

On Wed, Sep 8, 2010 at 8:50 AM, Jim Baker <jbaker@zyasoft.com> wrote:
Cliff,

You could use this recipe as a basis for something like this. The recipe is not at all general purpose (there was some controversy about its claims), but it does illustrate how you can introspect function frames without having to introduce another stack to record what's going on - that does work in a general fashion:
http://code.activestate.com/recipes/474088/

If you're interested in doing this sort of thing, I tend to favor the inspect module.

- Jim
--
"I'm not responcabel fer my computer's spleling errnors" - Xlorep DarkHelm
Website: http://darkhelm.org