A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-April/043958.html below:

Let's propose some useful built-in decorators

[Python-Dev] PEP 318: Let's propose some useful built-in decorators [Python-Dev] PEP 318: Let's propose some useful built-in decoratorsKevin 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 func_attrs(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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4