Kind people, Using Python 3.1 under FreeBSD and WinXP.
I've been tearing my hair out trying to solve this myself, but I need to ask for help. I want (for obscure reasons) to be able to log transactions in the namespace(s) of a script. Specifically I would like to log creation of identifiers, changes in the binding of identifiers ("assignment") and lookups. This turns out to be pretty easy in the global and local namespaces... I simply subclass dict, override the appropriate operations to include the logging operations I want, and then exec the code using my dictionaries as the global and local namespaces. All of this works just dandy until I try to extend it to functions. I cannot figure out any way to get a hook into the local namespace of a user defined function. I have tried making a wrapper class that grabs the function call and then uses exec to invoke myfunction.__code__ with my own dictionaries. This runs the (no argument) function properly (losing the return value, but I can deal with that) but never accesses the local logging dictionary that I specify in the exec() call. Perhaps the local namespace of a function is not a dict at all? Anyway, is there any way (however clumsy) to do what I want to do? Thank you for your help. Paul --------------------------- Paul LaFollette CIS Department Temple University paul.lafollette(at)temple.edu www.cis.temple.edu/~lafollet -- http://mail.python.org/mailman/listinfo/python-list