Need some decorator help. I have a class. And I want to add behavior to one of this class's methods to be run before the class runs the actual method. Is this what decorators are for?
So the class I want to work with is string.Template Let's say I have this: from string import Template a=Template("$var1 is a test") def preprocess(var1): #Real code here will be more complicated, just an example var1=var1.upper() a.substitute(var1="greg") So how can I have preprocess run before substitute is run? I want the user to be able to call a.substitute and have preprocess run automatically. Or is this not what decorators do? I'm trying to avoid subclassing if I can. Thanks in advance for the help. -Greg -- http://mail.python.org/mailman/listinfo/python-list