Decorator help

Joseph L. Casale jcasale at
Wed Mar 27 20:49:54 CET 2013

I have a class which sets up some class vars, then several methods that are passed in data
and do work referencing the class vars.

I want to decorate these methods, the decorator needs access to the class vars, so I thought
about making the decorator its own class and allowing it to accept args.

I was hoping to do all the work on in_data from within the decorator, which requires access
to several MyClass vars. Not clear on the syntax/usage with this approach here, any guidance
would be greatly appreciated!

Class MyDecorator(object):

    def __init__(self, arg1, arg2):
        self.arg1 = arg1
        self.arg2 = arg2

Class MyClass(object):
    def __init__(self):
        self.var_a = ....
    def meth_one(self, in_data):


More information about the Python-list mailing list