[Python-Dev] Re: Re: Call for defense of @decorators

Phillip J. Eby pje at telecommunity.com
Tue Aug 10 19:21:42 CEST 2004


At 12:07 PM 8/10/04 -0400, Chris King wrote:

>Now, is it really that important to a user whether a method is a class
>or static method?  They're all called the same way (so long as they're
>bound), and most users couldn't care less how a function is
>implemented.  If the distinction is really important to the user, then
>they will presumably be prudent enough to check for this by looking
>either just below the function name (or wherever decorators end up),
>or by reading the docstring if the function author decided to document
>that.

This doesn't apply to other decorators.  For example, some decorators turn 
a function into a property.  Others change the (effective) call signature.

Indeed, staticmethod changes the call signature, since there is no special 
first argument.

In frameworks where methods can be wrapped in transactions, lock 
synchronization, security checks, remote communication, etc., these are all 
decorations that are potentially part of the interface and important for 
the reader to know, even if they don't look at the method body (apart from 
the doc string).



More information about the Python-Dev mailing list