[Baypiggies] A few decorator questions...

Pete pfein at pobox.com
Thu Feb 26 19:29:10 CET 2009

On Feb 25, 2009, at 11:36 PM, Charles Merriam wrote:

> In the spirit of just in time research for the newbie nugget tomorrow:
> What decorators do most people actually use?  I expect everyone to use
> the built-in @classmethod, @staticmethod, and @property.   Also, I
> expect usage of many of the recipes from
> http://wiki.python.org/moin/PythonDecoratorLibrary, like @memoize or
> @trace.   Also, many different frameworks provide decorators for use
> with that framework.  Am I missing something obvious?

I write my own with fair regularity... they're a good way of reducing  
boilerplate code (in addition to the magic they can be used for):

def tryCommit(f):
     def wrapper(self, *args, **kwargs):
             ret=f(self, *args, **kwargs)
             return ret
     return wrapper

More information about the Baypiggies mailing list