[Python-Dev] PEP 318: Let's propose some useful built-in decorators (original) (raw)

Kevin Jacobs jacobs at theopalgroup.com
Fri Apr 2 15:03:15 EST 2004


Guido van Rossum wrote:

While I ponder the decorator syntax, let's propose some built-in decorators.

We've already got classmethod and staticmethod. I propose this one to set function attributes: class funcattrs(objects): def init(self, **kwds): self.attrs = kwds def call(self, funcobj): funcobj.dict.update(self.attrs)

Did you leave out the 'return funcobj' from the end of call? I thought that decorators were supposed to be inherently cooperative, and should return their modified funcobj, or a new func-like-obj.

Or maybe I haven't been paying close enough attention...

-Kevin



More information about the Python-Dev mailing list