Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

As a followup to the sibling comment, note that closures aren't the only way to achieve the same effect, for example:

    class MyDecorator(object):
      def __init__(self, func):
        self.func = func
      def __call__(self, one, two, three):
        # do stuff
        return self.func(three, two, one)
ie. you can just as easily use a class instance to store your state, instead of a closure. I routinely use both methods, depending on which is more useful at the time.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: