Hi! I'm building a class that most of methods have similar intro, something like this:
def method(self): var_one = self.attr_one var_two = self.attr_two.another_attr empty_list = [] # significant code goes here # ... It's done for clarity reasons, aliasing most used variables to shorted names and initializing some other common variables. I'm wondering if I can generalize it in any way. So far I couldn't come up with any solution. It smells like macros (which won't be implemented in Python, I know, I know ;), but maybe there is a way? I would like to code it that way: @init_local_variables def method(self): # significant code goes here # ... If only such a decorator exists... Thanks for any hints. mk -- . o . >> http://joker.linuxstuff.pl << . . o It's easier to get forgiveness for being wrong o o o than forgiveness for being right. -- http://mail.python.org/mailman/listinfo/python-list